annotate libpurple/mediamanager.c @ 26381:6bcf5ad967ea

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