Mon, 23 Mar 2009 02:59:18 +0000
Move GStreamer related media functions into its own header.
| 19883 | 1 | /** |
| 19889 | 2 | * @file mediamanager.c Media Manager API |
| 19883 | 3 | * @ingroup core |
|
26105
7647c0dcf202
* Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
4 | */ |
|
7647c0dcf202
* Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
5 | |
|
7647c0dcf202
* Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
6 | /* purple |
| 19883 | 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 | ||
| 19889 | 27 | #include "internal.h" |
| 28 | ||
| 19883 | 29 | #include "connection.h" |
|
26130
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
30 | #include "debug.h" |
|
26111
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
31 | #include "marshallers.h" |
|
26479
47511dae9f81
Move GStreamer related media functions into its own header.
Michael Ruprecht <maiku@pidgin.im>
parents:
26427
diff
changeset
|
32 | #include "media.h" |
|
47511dae9f81
Move GStreamer related media functions into its own header.
Michael Ruprecht <maiku@pidgin.im>
parents:
26427
diff
changeset
|
33 | #include "media-gst.h" |
| 19883 | 34 | #include "mediamanager.h" |
| 35 | ||
|
23704
9b88c9b23aed
Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents:
23701
diff
changeset
|
36 | #ifdef USE_VV |
| 19883 | 37 | |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22071
diff
changeset
|
38 | #include <gst/farsight/fs-conference-iface.h> |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
39 | #include <gst/interfaces/xoverlay.h> |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
40 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
41 | typedef struct _PurpleMediaOutputWindow PurpleMediaOutputWindow; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
42 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
43 | struct _PurpleMediaOutputWindow |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
44 | { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
45 | gulong id; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
46 | PurpleMedia *media; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
47 | gchar *session_id; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
48 | gchar *participant; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
49 | gulong window_id; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
50 | GstElement *sink; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
51 | }; |
| 19883 | 52 | |
| 53 | struct _PurpleMediaManagerPrivate | |
| 54 | { | |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
55 | GstElement *pipeline; |
| 19883 | 56 | GList *medias; |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
57 | GList *elements; |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
58 | GList *output_windows; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
59 | gulong next_output_window_id; |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
60 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
61 | PurpleMediaElementInfo *video_src; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
62 | PurpleMediaElementInfo *video_sink; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
63 | PurpleMediaElementInfo *audio_src; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
64 | PurpleMediaElementInfo *audio_sink; |
| 19883 | 65 | }; |
| 66 | ||
| 67 | #define PURPLE_MEDIA_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerPrivate)) | |
| 68 | ||
| 69 | static void purple_media_manager_class_init (PurpleMediaManagerClass *klass); | |
| 70 | static void purple_media_manager_init (PurpleMediaManager *media); | |
| 71 | static void purple_media_manager_finalize (GObject *object); | |
| 72 | ||
| 73 | static GObjectClass *parent_class = NULL; | |
| 74 | ||
| 75 | ||
| 76 | ||
| 77 | enum { | |
|
19885
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
78 | INIT_MEDIA, |
| 19883 | 79 | LAST_SIGNAL |
| 80 | }; | |
| 81 | static guint purple_media_manager_signals[LAST_SIGNAL] = {0}; | |
| 82 | ||
| 83 | enum { | |
| 84 | PROP_0, | |
| 85 | PROP_FARSIGHT_SESSION, | |
| 86 | PROP_NAME, | |
| 87 | PROP_CONNECTION, | |
| 88 | PROP_MIC_ELEMENT, | |
| 89 | PROP_SPEAKER_ELEMENT, | |
| 90 | }; | |
| 91 | ||
| 92 | GType | |
| 93 | purple_media_manager_get_type() | |
| 94 | { | |
| 95 | static GType type = 0; | |
| 96 | ||
| 97 | if (type == 0) { | |
| 98 | static const GTypeInfo info = { | |
| 99 | sizeof(PurpleMediaManagerClass), | |
| 100 | NULL, | |
| 101 | NULL, | |
| 102 | (GClassInitFunc) purple_media_manager_class_init, | |
| 103 | NULL, | |
| 104 | NULL, | |
| 105 | sizeof(PurpleMediaManager), | |
| 106 | 0, | |
|
22071
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19889
diff
changeset
|
107 | (GInstanceInitFunc) purple_media_manager_init, |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19889
diff
changeset
|
108 | NULL |
| 19883 | 109 | }; |
| 110 | type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0); | |
| 111 | } | |
| 112 | return type; | |
| 113 | } | |
| 114 | ||
| 115 | ||
| 116 | static void | |
| 117 | purple_media_manager_class_init (PurpleMediaManagerClass *klass) | |
| 118 | { | |
| 119 | GObjectClass *gobject_class = (GObjectClass*)klass; | |
| 120 | parent_class = g_type_class_peek_parent(klass); | |
| 121 | ||
| 122 | gobject_class->finalize = purple_media_manager_finalize; | |
| 123 | ||
|
19885
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
124 | purple_media_manager_signals[INIT_MEDIA] = g_signal_new ("init-media", |
| 19883 | 125 | G_TYPE_FROM_CLASS (klass), |
| 126 | G_SIGNAL_RUN_LAST, | |
| 127 | 0, NULL, NULL, | |
|
26183
d78798f480da
Remove connection attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26150
diff
changeset
|
128 | purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING, |
|
d78798f480da
Remove connection attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26150
diff
changeset
|
129 | G_TYPE_BOOLEAN, 3, PURPLE_TYPE_MEDIA, |
|
d78798f480da
Remove connection attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26150
diff
changeset
|
130 | G_TYPE_POINTER, G_TYPE_STRING); |
| 19884 | 131 | g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate)); |
| 19883 | 132 | } |
| 133 | ||
| 134 | static void | |
| 135 | purple_media_manager_init (PurpleMediaManager *media) | |
| 136 | { | |
| 137 | media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); | |
| 19884 | 138 | media->priv->medias = NULL; |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
139 | media->priv->next_output_window_id = 1; |
| 19883 | 140 | } |
| 141 | ||
| 142 | static void | |
| 143 | purple_media_manager_finalize (GObject *media) | |
| 144 | { | |
|
26115
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
145 | PurpleMediaManagerPrivate *priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
146 | for (; priv->medias; priv->medias = |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
147 | g_list_delete_link(priv->medias, priv->medias)) { |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
148 | g_object_unref(priv->medias->data); |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
149 | } |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
150 | for (; priv->elements; priv->elements = |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
151 | g_list_delete_link(priv->elements, priv->elements)); |
| 19883 | 152 | parent_class->finalize(media); |
| 153 | } | |
| 154 | ||
| 155 | PurpleMediaManager * | |
| 156 | purple_media_manager_get() | |
| 157 | { | |
| 158 | static PurpleMediaManager *manager = NULL; | |
| 159 | ||
| 160 | if (manager == NULL) | |
| 161 | manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL)); | |
| 162 | return manager; | |
| 163 | } | |
| 164 | ||
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
165 | static gboolean |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
166 | pipeline_bus_call(GstBus *bus, GstMessage *msg, PurpleMediaManager *manager) |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
167 | { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
168 | switch(GST_MESSAGE_TYPE(msg)) { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
169 | case GST_MESSAGE_EOS: |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
170 | purple_debug_info("mediamanager", "End of Stream\n"); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
171 | break; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
172 | case GST_MESSAGE_ERROR: { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
173 | gchar *debug = NULL; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
174 | GError *err = NULL; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
175 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
176 | gst_message_parse_error(msg, &err, &debug); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
177 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
178 | purple_debug_error("mediamanager", |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
179 | "gst pipeline error: %s\n", |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
180 | err->message); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
181 | g_error_free(err); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
182 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
183 | if (debug) { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
184 | purple_debug_error("mediamanager", |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
185 | "Debug details: %s\n", debug); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
186 | g_free (debug); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
187 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
188 | break; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
189 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
190 | default: |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
191 | break; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
192 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
193 | return TRUE; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
194 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
195 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
196 | GstElement * |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
197 | purple_media_manager_get_pipeline(PurpleMediaManager *manager) |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
198 | { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
199 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
200 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
201 | if (manager->priv->pipeline == NULL) { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
202 | GstBus *bus; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
203 | manager->priv->pipeline = gst_pipeline_new(NULL); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
204 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
205 | bus = gst_pipeline_get_bus( |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
206 | GST_PIPELINE(manager->priv->pipeline)); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
207 | gst_bus_add_signal_watch(GST_BUS(bus)); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
208 | g_signal_connect(G_OBJECT(bus), "message", |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
209 | G_CALLBACK(pipeline_bus_call), manager); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
210 | gst_bus_set_sync_handler(bus, |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
211 | gst_bus_sync_signal_handler, NULL); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
212 | gst_object_unref(bus); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
213 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
214 | gst_element_set_state(manager->priv->pipeline, |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
215 | GST_STATE_PLAYING); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
216 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
217 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
218 | return manager->priv->pipeline; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
219 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
220 | |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22071
diff
changeset
|
221 | PurpleMedia * |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22071
diff
changeset
|
222 | purple_media_manager_create_media(PurpleMediaManager *manager, |
| 19883 | 223 | PurpleConnection *gc, |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22071
diff
changeset
|
224 | const char *conference_type, |
|
26187
3b3059a7c091
Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26185
diff
changeset
|
225 | const char *remote_user, |
|
3b3059a7c091
Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26185
diff
changeset
|
226 | gboolean initiator) |
| 19883 | 227 | { |
|
23701
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
228 | PurpleMedia *media; |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22071
diff
changeset
|
229 | FsConference *conference = FS_CONFERENCE(gst_element_factory_make(conference_type, NULL)); |
|
26096
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
230 | GstStateChangeReturn ret; |
|
26111
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
231 | gboolean signal_ret; |
|
23701
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
232 | |
|
26130
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
233 | if (conference == NULL) { |
|
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
234 | purple_conv_present_error(remote_user, |
|
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
235 | purple_connection_get_account(gc), |
|
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
236 | _("Error creating conference.")); |
|
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
237 | purple_debug_error("media", "Conference == NULL\n"); |
|
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
238 | return NULL; |
|
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
239 | } |
|
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
240 | |
|
23701
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
241 | media = PURPLE_MEDIA(g_object_new(purple_media_get_type(), |
|
26315
c72d67da93eb
Use the media manager that created the media session in media.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
242 | "manager", manager, |
|
26327
6a436310d508
Added the connection property back to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26323
diff
changeset
|
243 | "connection", gc, |
|
26185
6061487f59a7
Rename "fs-conference" to "conference".
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
244 | "conference", conference, |
|
26187
3b3059a7c091
Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26185
diff
changeset
|
245 | "initiator", initiator, |
|
23701
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
246 | NULL)); |
|
26096
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
247 | |
|
26276
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26187
diff
changeset
|
248 | ret = gst_element_set_state(GST_ELEMENT(conference), GST_STATE_PLAYING); |
|
26096
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
249 | |
|
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
250 | if (ret == GST_STATE_CHANGE_FAILURE) { |
|
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
251 | purple_conv_present_error(remote_user, |
|
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
252 | purple_connection_get_account(gc), |
|
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
253 | _("Error creating conference.")); |
|
26130
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
254 | purple_debug_error("media", "Failed to start conference.\n"); |
|
26096
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
255 | g_object_unref(media); |
|
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
256 | return NULL; |
|
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
257 | } |
|
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
258 | |
|
26111
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
259 | g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0, |
|
26183
d78798f480da
Remove connection attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26150
diff
changeset
|
260 | media, gc, remote_user, &signal_ret); |
|
26111
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
261 | |
|
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
262 | if (signal_ret == FALSE) { |
|
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
263 | g_object_unref(media); |
|
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
264 | return NULL; |
|
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
265 | } |
|
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
266 | |
| 19883 | 267 | manager->priv->medias = g_list_append(manager->priv->medias, media); |
| 268 | return media; | |
| 269 | } | |
| 270 | ||
|
26115
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
271 | GList * |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
272 | purple_media_manager_get_media(PurpleMediaManager *manager) |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
273 | { |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
274 | return manager->priv->medias; |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
275 | } |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
276 | |
|
26329
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
277 | GList * |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
278 | purple_media_manager_get_media_by_connection(PurpleMediaManager *manager, |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
279 | PurpleConnection *pc) |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
280 | { |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
281 | GList *media = NULL; |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
282 | GList *iter; |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
283 | |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
284 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
285 | |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
286 | iter = manager->priv->medias; |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
287 | for (; iter; iter = g_list_next(iter)) { |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
288 | if (purple_media_get_connection(iter->data) == pc) { |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
289 | media = g_list_prepend(media, iter->data); |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
290 | } |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
291 | } |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
292 | |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
293 | return media; |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
294 | } |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
295 | |
|
26115
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
296 | void |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
297 | purple_media_manager_remove_media(PurpleMediaManager *manager, |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
298 | PurpleMedia *media) |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
299 | { |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
300 | GList *list = g_list_find(manager->priv->medias, media); |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
301 | if (list) |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
302 | manager->priv->medias = |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
303 | g_list_delete_link(manager->priv->medias, list); |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
304 | } |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
305 | |
|
26150
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
306 | GstElement * |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
307 | purple_media_manager_get_element(PurpleMediaManager *manager, |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
308 | PurpleMediaSessionType type) |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
309 | { |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
310 | GstElement *ret = NULL; |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
311 | |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
312 | /* TODO: If src, retrieve current src */ |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
313 | /* TODO: Send a signal here to allow for overriding the source/sink */ |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
314 | |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
315 | if (type & PURPLE_MEDIA_SEND_AUDIO |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
316 | && manager->priv->audio_src != NULL) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
317 | ret = manager->priv->audio_src->create(); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
318 | else if (type & PURPLE_MEDIA_RECV_AUDIO |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
319 | && manager->priv->audio_sink != NULL) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
320 | ret = manager->priv->audio_sink->create(); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
321 | else if (type & PURPLE_MEDIA_SEND_VIDEO |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
322 | && manager->priv->video_src != NULL) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
323 | ret = manager->priv->video_src->create(); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
324 | else if (type & PURPLE_MEDIA_RECV_VIDEO |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
325 | && manager->priv->video_sink != NULL) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
326 | ret = manager->priv->video_sink->create(); |
|
26150
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
327 | |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
328 | if (ret == NULL) |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
329 | purple_debug_error("media", "Error creating source or sink\n"); |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
330 | |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
331 | return ret; |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
332 | } |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
333 | |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
334 | PurpleMediaElementInfo * |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
335 | purple_media_manager_get_element_info(PurpleMediaManager *manager, |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
336 | const gchar *id) |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
337 | { |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
338 | GList *iter; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
339 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
340 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
341 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
342 | iter = manager->priv->elements; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
343 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
344 | for (; iter; iter = g_list_next(iter)) { |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
345 | PurpleMediaElementInfo *info = iter->data; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
346 | if (!strcmp(info->id, id)) |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
347 | return info; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
348 | } |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
349 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
350 | return NULL; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
351 | } |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
352 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
353 | gboolean |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
354 | purple_media_manager_register_element(PurpleMediaManager *manager, |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
355 | PurpleMediaElementInfo *info) |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
356 | { |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
357 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
358 | g_return_val_if_fail(info != NULL, FALSE); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
359 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
360 | if (purple_media_manager_get_element_info(manager, info->id) != NULL) |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
361 | return FALSE; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
362 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
363 | manager->priv->elements = |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
364 | g_list_prepend(manager->priv->elements, info); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
365 | return TRUE; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
366 | } |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
367 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
368 | gboolean |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
369 | purple_media_manager_unregister_element(PurpleMediaManager *manager, |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
370 | const gchar *id) |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
371 | { |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
372 | PurpleMediaElementInfo *info; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
373 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
374 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
375 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
376 | info = purple_media_manager_get_element_info(manager, id); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
377 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
378 | if (info == NULL) |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
379 | return FALSE; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
380 | |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
381 | if (manager->priv->audio_src == info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
382 | manager->priv->audio_src = NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
383 | if (manager->priv->audio_sink == info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
384 | manager->priv->audio_sink = NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
385 | if (manager->priv->video_src == info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
386 | manager->priv->video_src = NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
387 | if (manager->priv->video_sink == info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
388 | manager->priv->video_sink = NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
389 | |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
390 | manager->priv->elements = g_list_remove( |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
391 | manager->priv->elements, info); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
392 | return TRUE; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
393 | } |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
394 | |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
395 | gboolean |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
396 | purple_media_manager_set_active_element(PurpleMediaManager *manager, |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
397 | PurpleMediaElementInfo *info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
398 | { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
399 | gboolean ret = FALSE; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
400 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
401 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
402 | g_return_val_if_fail(info != NULL, FALSE); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
403 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
404 | if (purple_media_manager_get_element_info(manager, info->id) == NULL) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
405 | purple_media_manager_register_element(manager, info); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
406 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
407 | if (info->type & PURPLE_MEDIA_ELEMENT_SRC) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
408 | if (info->type & PURPLE_MEDIA_ELEMENT_AUDIO) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
409 | manager->priv->audio_src = info; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
410 | ret = TRUE; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
411 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
412 | if (info->type & PURPLE_MEDIA_ELEMENT_VIDEO) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
413 | manager->priv->video_src = info; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
414 | ret = TRUE; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
415 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
416 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
417 | if (info->type & PURPLE_MEDIA_ELEMENT_SINK) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
418 | if (info->type & PURPLE_MEDIA_ELEMENT_AUDIO) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
419 | manager->priv->audio_sink = info; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
420 | ret = TRUE; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
421 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
422 | if (info->type & PURPLE_MEDIA_ELEMENT_VIDEO) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
423 | manager->priv->video_sink = info; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
424 | ret = TRUE; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
425 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
426 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
427 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
428 | return ret; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
429 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
430 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
431 | PurpleMediaElementInfo * |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
432 | purple_media_manager_get_active_element(PurpleMediaManager *manager, |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
433 | PurpleMediaElementType type) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
434 | { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
435 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
436 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
437 | if (type & PURPLE_MEDIA_ELEMENT_SRC) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
438 | if (type & PURPLE_MEDIA_ELEMENT_AUDIO) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
439 | return manager->priv->audio_src; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
440 | else if (type & PURPLE_MEDIA_ELEMENT_VIDEO) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
441 | return manager->priv->video_src; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
442 | } else if (type & PURPLE_MEDIA_ELEMENT_SINK) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
443 | if (type & PURPLE_MEDIA_ELEMENT_AUDIO) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
444 | return manager->priv->audio_sink; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
445 | else if (type & PURPLE_MEDIA_ELEMENT_VIDEO) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
446 | return manager->priv->video_sink; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
447 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
448 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
449 | return NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
450 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
451 | |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
452 | static void |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
453 | window_id_cb(GstBus *bus, GstMessage *msg, PurpleMediaOutputWindow *ow) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
454 | { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
455 | if (GST_MESSAGE_TYPE(msg) != GST_MESSAGE_ELEMENT || |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
456 | !gst_structure_has_name(msg->structure, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
457 | "prepare-xwindow-id")) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
458 | return; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
459 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
460 | if (GST_ELEMENT_PARENT(GST_MESSAGE_SRC(msg)) == ow->sink) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
461 | g_signal_handlers_disconnect_matched(bus, G_SIGNAL_MATCH_FUNC |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
462 | | G_SIGNAL_MATCH_DATA, 0, 0, NULL, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
463 | window_id_cb, ow); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
464 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
465 | gst_x_overlay_set_xwindow_id(GST_X_OVERLAY( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
466 | GST_MESSAGE_SRC(msg)), ow->window_id); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
467 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
468 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
469 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
470 | gboolean |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
471 | purple_media_manager_create_output_window(PurpleMediaManager *manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
472 | PurpleMedia *media, const gchar *session_id, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
473 | const gchar *participant) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
474 | { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
475 | GList *iter; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
476 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
477 | g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
478 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
479 | iter = manager->priv->output_windows; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
480 | for(; iter; iter = g_list_next(iter)) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
481 | PurpleMediaOutputWindow *ow = iter->data; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
482 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
483 | if (ow->sink == NULL && ow->media == media && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
484 | ((participant != NULL && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
485 | ow->participant != NULL && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
486 | !strcmp(participant, ow->participant)) || |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
487 | (participant == ow->participant)) && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
488 | !strcmp(session_id, ow->session_id)) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
489 | GstBus *bus; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
490 | GstElement *queue; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
491 | GstElement *tee = purple_media_get_tee(media, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
492 | session_id, participant); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
493 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
494 | if (tee == NULL) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
495 | continue; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
496 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
497 | queue = gst_element_factory_make( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
498 | "queue", NULL); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
499 | ow->sink = purple_media_manager_get_element( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
500 | manager, PURPLE_MEDIA_RECV_VIDEO); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
501 | |
|
26427
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
502 | if (participant == NULL) { |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
503 | /* aka this is a preview sink */ |
|
26427
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
504 | GObjectClass *klass = |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
505 | G_OBJECT_GET_CLASS(ow->sink); |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
506 | if (g_object_class_find_property(klass, |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
507 | "sync")) |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
508 | g_object_set(G_OBJECT(ow->sink), |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
509 | "sync", "FALSE", NULL); |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
510 | if (g_object_class_find_property(klass, |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
511 | "async")) |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
512 | g_object_set(G_OBJECT(ow->sink), |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
513 | "async", FALSE, NULL); |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
514 | } |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
515 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
516 | gst_bin_add_many(GST_BIN(GST_ELEMENT_PARENT(tee)), |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
517 | queue, ow->sink, NULL); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
518 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
519 | bus = gst_pipeline_get_bus(GST_PIPELINE( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
520 | manager->priv->pipeline)); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
521 | g_signal_connect(bus, "sync-message::element", |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
522 | G_CALLBACK(window_id_cb), ow); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
523 | gst_object_unref(bus); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
524 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
525 | gst_element_sync_state_with_parent(ow->sink); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
526 | gst_element_link(queue, ow->sink); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
527 | gst_element_sync_state_with_parent(queue); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
528 | gst_element_link(tee, queue); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
529 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
530 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
531 | return TRUE; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
532 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
533 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
534 | gulong |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
535 | purple_media_manager_set_output_window(PurpleMediaManager *manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
536 | PurpleMedia *media, const gchar *session_id, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
537 | const gchar *participant, gulong window_id) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
538 | { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
539 | PurpleMediaOutputWindow *output_window; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
540 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
541 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
542 | g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
543 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
544 | output_window = g_new0(PurpleMediaOutputWindow, 1); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
545 | output_window->id = manager->priv->next_output_window_id++; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
546 | output_window->media = media; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
547 | output_window->session_id = g_strdup(session_id); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
548 | output_window->participant = g_strdup(participant); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
549 | output_window->window_id = window_id; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
550 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
551 | manager->priv->output_windows = g_list_prepend( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
552 | manager->priv->output_windows, output_window); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
553 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
554 | if (purple_media_get_tee(media, session_id, participant) != NULL) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
555 | purple_media_manager_create_output_window(manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
556 | media, session_id, participant); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
557 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
558 | return output_window->id; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
559 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
560 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
561 | gboolean |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
562 | purple_media_manager_remove_output_window(PurpleMediaManager *manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
563 | gulong output_window_id) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
564 | { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
565 | PurpleMediaOutputWindow *output_window = NULL; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
566 | GList *iter; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
567 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
568 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
569 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
570 | iter = manager->priv->output_windows; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
571 | for (; iter; iter = g_list_next(iter)) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
572 | PurpleMediaOutputWindow *ow = iter->data; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
573 | if (ow->id == output_window_id) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
574 | manager->priv->output_windows = g_list_delete_link( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
575 | manager->priv->output_windows, iter); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
576 | output_window = ow; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
577 | break; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
578 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
579 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
580 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
581 | if (output_window == NULL) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
582 | return FALSE; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
583 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
584 | if (output_window->sink != NULL) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
585 | GstPad *pad = gst_element_get_static_pad( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
586 | output_window->sink, "sink"); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
587 | GstPad *peer = gst_pad_get_peer(pad); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
588 | GstElement *queue = GST_ELEMENT_PARENT(peer); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
589 | gst_object_unref(pad); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
590 | pad = gst_element_get_static_pad(queue, "sink"); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
591 | peer = gst_pad_get_peer(pad); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
592 | gst_object_unref(pad); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
593 | gst_element_release_request_pad(GST_ELEMENT_PARENT(peer), peer); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
594 | gst_element_set_locked_state(queue, TRUE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
595 | gst_element_set_state(queue, GST_STATE_NULL); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
596 | gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(queue)), queue); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
597 | gst_element_set_locked_state(output_window->sink, TRUE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
598 | gst_element_set_state(output_window->sink, GST_STATE_NULL); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
599 | gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(output_window->sink)), |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
600 | output_window->sink); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
601 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
602 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
603 | g_free(output_window->session_id); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
604 | g_free(output_window->participant); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
605 | g_free(output_window); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
606 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
607 | return TRUE; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
608 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
609 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
610 | void |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
611 | purple_media_manager_remove_output_windows(PurpleMediaManager *manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
612 | PurpleMedia *media, const gchar *session_id, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
613 | const gchar *participant) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
614 | { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
615 | GList *iter; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
616 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
617 | g_return_if_fail(PURPLE_IS_MEDIA(media)); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
618 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
619 | iter = manager->priv->output_windows; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
620 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
621 | for (; iter;) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
622 | PurpleMediaOutputWindow *ow = iter->data; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
623 | iter = g_list_next(iter); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
624 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
625 | if (media == ow->media && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
626 | ((session_id != NULL && ow->session_id != NULL && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
627 | !strcmp(session_id, ow->session_id)) || |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
628 | (session_id == ow->session_id)) && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
629 | ((participant != NULL && ow->participant != NULL && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
630 | !strcmp(participant, ow->participant)) || |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
631 | (participant == ow->participant))) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
632 | purple_media_manager_remove_output_window( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
633 | manager, ow->id); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
634 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
635 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
636 | |
|
23704
9b88c9b23aed
Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents:
23701
diff
changeset
|
637 | #endif /* USE_VV */ |