annotate libpurple/mediamanager.c @ 26457:20743d9bd62d

Fix allowing gmail user to initiate voice call by advertising a specific ext From xep-0115 v1.3: "The names of the feature bundles MUST NOT be used for semantic purposes: they are merely opaque identifiers that will be used in other use cases."
author Paul Aurich <paul@darkrain42.org>
date Sat, 04 Apr 2009 17:01:59 +0000
parents 90c65a8575bf
children df9042312063
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
26400
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
41 /** @copydoc _PurpleMediaManagerPrivate */
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
42 typedef struct _PurpleMediaManagerPrivate PurpleMediaManagerPrivate;
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
43 /** @copydoc _PurpleMediaOutputWindow */
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
44 typedef struct _PurpleMediaOutputWindow PurpleMediaOutputWindow;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
45 /** @copydoc _PurpleMediaManagerPrivate */
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
46 typedef struct _PurpleMediaElementInfoPrivate PurpleMediaElementInfoPrivate;
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
47
26400
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
48 /** The media manager class. */
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
49 struct _PurpleMediaManagerClass
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
50 {
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
51 GObjectClass parent_class; /**< The parent class. */
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
52 };
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
53
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
54 /** The media manager's data. */
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
55 struct _PurpleMediaManager
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
56 {
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
57 GObject parent; /**< The parent of this manager. */
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
58 PurpleMediaManagerPrivate *priv; /**< Private data for the manager. */
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
59 };
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
60
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
61 struct _PurpleMediaOutputWindow
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
62 {
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
63 gulong id;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
64 PurpleMedia *media;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
65 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
66 gchar *participant;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
67 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
68 GstElement *sink;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
69 };
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 struct _PurpleMediaManagerPrivate
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 {
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
73 GstElement *pipeline;
26390
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
74 PurpleMediaCaps ui_caps;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 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
76 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
77 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
78 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
79
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
80 PurpleMediaElementInfo *video_src;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
81 PurpleMediaElementInfo *video_sink;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
82 PurpleMediaElementInfo *audio_src;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
83 PurpleMediaElementInfo *audio_sink;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 #define PURPLE_MEDIA_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerPrivate))
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
87 #define PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfoPrivate))
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 static void purple_media_manager_class_init (PurpleMediaManagerClass *klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 static void purple_media_manager_init (PurpleMediaManager *media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 static void purple_media_manager_finalize (GObject *object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 static GObjectClass *parent_class = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 enum {
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23761
diff changeset
98 INIT_MEDIA,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 LAST_SIGNAL
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 static guint purple_media_manager_signals[LAST_SIGNAL] = {0};
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
102 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 GType
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 purple_media_manager_get_type()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 {
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
107 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 static GType type = 0;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 if (type == 0) {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 static const GTypeInfo info = {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 sizeof(PurpleMediaManagerClass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 (GClassInitFunc) purple_media_manager_class_init,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 sizeof(PurpleMediaManager),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 0,
23772
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
120 (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
121 NULL
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 return type;
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
126 #else
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
127 return G_TYPE_NONE;
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
128 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
131 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 purple_media_manager_class_init (PurpleMediaManagerClass *klass)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 GObjectClass *gobject_class = (GObjectClass*)klass;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 parent_class = g_type_class_peek_parent(klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 gobject_class->finalize = purple_media_manager_finalize;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23761
diff changeset
140 purple_media_manager_signals[INIT_MEDIA] = g_signal_new ("init-media",
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 G_TYPE_FROM_CLASS (klass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 G_SIGNAL_RUN_LAST,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 0, NULL, NULL,
24983
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
144 purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING,
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
145 G_TYPE_BOOLEAN, 3, PURPLE_TYPE_MEDIA,
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
146 G_TYPE_POINTER, G_TYPE_STRING);
23761
2fda71133800 Some UI ;)
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
147 g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 purple_media_manager_init (PurpleMediaManager *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media);
23761
2fda71133800 Some UI ;)
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
154 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
155 media->priv->next_output_window_id = 1;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 purple_media_manager_finalize (GObject *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 {
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
161 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
162 for (; priv->medias; priv->medias =
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
163 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
164 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
165 }
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
166 for (; priv->elements; priv->elements =
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
167 g_list_delete_link(priv->elements, priv->elements)) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
168 g_object_unref(priv->elements->data);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
169 }
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 parent_class->finalize(media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 }
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
172 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 PurpleMediaManager *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 purple_media_manager_get()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 {
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
177 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 static PurpleMediaManager *manager = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 if (manager == NULL)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL));
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 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
183 #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
184 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
185 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
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
188 #ifdef USE_VV
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
189 static gboolean
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
190 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
191 {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
192 switch(GST_MESSAGE_TYPE(msg)) {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
193 case GST_MESSAGE_EOS:
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
194 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
195 break;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
196 case GST_MESSAGE_ERROR: {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
197 gchar *debug = NULL;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
198 GError *err = NULL;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
199
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
200 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
201
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
202 purple_debug_error("mediamanager",
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
203 "gst pipeline error: %s\n",
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
204 err->message);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
205 g_error_free(err);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
206
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
207 if (debug) {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
208 purple_debug_error("mediamanager",
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
209 "Debug details: %s\n", debug);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
210 g_free (debug);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
211 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
212 break;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
213 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
214 default:
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
215 break;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
216 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
217 return TRUE;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
218 }
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
219 #endif
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
220
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
221 GstElement *
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
222 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
223 {
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
224 #ifdef USE_VV
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
225 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
226
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
227 if (manager->priv->pipeline == NULL) {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
228 GstBus *bus;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
229 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
230
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
231 bus = gst_pipeline_get_bus(
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
232 GST_PIPELINE(manager->priv->pipeline));
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
233 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
234 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
235 G_CALLBACK(pipeline_bus_call), manager);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
236 gst_bus_set_sync_handler(bus,
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
237 gst_bus_sync_signal_handler, NULL);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
238 gst_object_unref(bus);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
239
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
240 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
241 GST_STATE_PLAYING);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
242 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
243
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
244 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
245 #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
246 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
247 #endif
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
248 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
249
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
250 PurpleMedia *
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
251 purple_media_manager_create_media(PurpleMediaManager *manager,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 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
253 const char *conference_type,
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
254 const char *remote_user,
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
255 gboolean initiator)
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 {
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
257 #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
258 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
259 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
260 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
261 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
262
24930
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
263 if (conference == NULL) {
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
264 purple_conv_present_error(remote_user,
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
265 purple_connection_get_account(gc),
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
266 _("Error creating conference."));
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
267 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
268 return NULL;
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
269 }
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
270
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
271 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
272 "manager", manager,
26121
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
273 "connection", gc,
24985
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
274 "conference", conference,
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
275 "initiator", initiator,
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
276 NULL));
23856
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
277
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
278 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
279
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
280 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
281 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
282 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
283 _("Error creating conference."));
24930
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
284 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
285 g_object_unref(media);
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
286 return NULL;
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
287 }
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
288
23872
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
289 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
290 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
291
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
292 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
293 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
294 return NULL;
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
295 }
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
296
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 manager->priv->medias = g_list_append(manager->priv->medias, media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 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
299 #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
300 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
301 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
304 GList *
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
305 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
306 {
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
307 #ifdef USE_VV
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
308 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
309 #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
310 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
311 #endif
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
312 }
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
313
26123
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
314 GList *
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
315 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
316 PurpleConnection *pc)
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
317 {
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
318 #ifdef USE_VV
26123
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
319 GList *media = NULL;
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
320 GList *iter;
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
321
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
322 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
323
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
324 iter = manager->priv->medias;
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
325 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
326 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
327 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
328 }
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
329 }
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
330
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
331 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
332 #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
333 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
334 #endif
26123
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
335 }
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
336
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
337 void
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
338 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
339 PurpleMedia *media)
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
340 {
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
341 #ifdef USE_VV
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
342 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
343 if (list)
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
344 manager->priv->medias =
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
345 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
346 #endif
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
347 }
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
348
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
349 #ifdef USE_VV
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
350 static void
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
351 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
352 {
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
353 GstElement *parent = GST_ELEMENT_PARENT(pad);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
354 GstIterator *iter;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
355 GstPad *remaining_pad;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
356
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
357 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
358 iter = gst_element_iterate_pads(parent);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
359
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
360 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
361 == GST_ITERATOR_DONE) {
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
362 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
363 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
364 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
365 }
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
366
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
367 gst_iterator_free(iter);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
368 }
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
369 #endif
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
370
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
371 GstElement *
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
372 purple_media_manager_get_element(PurpleMediaManager *manager,
26392
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26390
diff changeset
373 PurpleMediaSessionType type, PurpleMedia *media,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26390
diff changeset
374 const gchar *session_id, const gchar *participant)
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
375 {
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
376 #ifdef USE_VV
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
377 GstElement *ret = NULL;
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
378 PurpleMediaElementInfo *info = NULL;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
379 PurpleMediaElementType element_type;
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
380
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
381 if (type & PURPLE_MEDIA_SEND_AUDIO)
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
382 info = manager->priv->audio_src;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
383 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
384 info = manager->priv->audio_sink;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
385 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
386 info = manager->priv->video_src;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
387 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
388 info = manager->priv->video_sink;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
389
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
390 if (info == NULL)
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
391 return NULL;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
392
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
393 element_type = purple_media_element_info_get_element_type(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
394
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
395 if (element_type & PURPLE_MEDIA_ELEMENT_UNIQUE &&
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
396 element_type & PURPLE_MEDIA_ELEMENT_SRC) {
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
397 GstElement *tee;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
398 GstPad *pad;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
399 GstPad *ghost;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
400 gchar *id = purple_media_element_info_get_id(info);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
401
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
402 ret = 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
403 purple_media_manager_get_pipeline(
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
404 manager)), id);
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
405
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
406 if (ret == NULL) {
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
407 GstElement *bin, *fakesink;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
408 ret = purple_media_element_info_call_create(info,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
409 media, session_id, participant);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
410 bin = gst_bin_new(id);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
411 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
412 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
413 gst_element_link(ret, tee);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
414
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
415 /*
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
416 * 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
417 * 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
418 */
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
419 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
420 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
421 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
422 gst_element_link(tee, fakesink);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
423
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
424 ret = bin;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
425 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
426 gst_object_ref(ret);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
427 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
428 manager)), ret);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
429 }
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
430 g_free(id);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
431
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
432 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
433 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
434 gst_object_unref(tee);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
435 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
436 gst_object_unref(pad);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
437 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
438 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
439 gst_pad_set_active(ghost, TRUE);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
440 gst_element_add_pad(ret, ghost);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
441 } else {
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
442 ret = purple_media_element_info_call_create(info,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
443 media, session_id, participant);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
444 }
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
445
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
446 if (ret == NULL)
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
447 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
448
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
449 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
450 #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
451 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
452 #endif
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
453 }
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
454
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
455 PurpleMediaElementInfo *
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
456 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
457 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
458 {
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
459 #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
460 GList *iter;
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
461
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
462 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
463
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
464 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
465
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
466 for (; iter; iter = g_list_next(iter)) {
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
467 gchar *element_id =
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
468 purple_media_element_info_get_id(iter->data);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
469 if (!strcmp(element_id, id)) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
470 g_free(element_id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
471 g_object_ref(iter->data);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
472 return iter->data;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
473 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
474 g_free(element_id);
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
475 }
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
476 #endif
26081
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 return NULL;
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
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
481 gboolean
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
482 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
483 PurpleMediaElementInfo *info)
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
484 {
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
485 #ifdef USE_VV
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
486 PurpleMediaElementInfo *info2;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
487 gchar *id;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
488
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
489 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
490 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
491
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
492 id = purple_media_element_info_get_id(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
493 info2 = purple_media_manager_get_element_info(manager, id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
494 g_free(id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
495
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
496 if (info2 != NULL) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
497 g_object_unref(info2);
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
498 return FALSE;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
499 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
500 g_object_unref(info2);
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
501
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
502 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
503 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
504 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
505 #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
506 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
507 #endif
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
508 }
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
509
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
510 gboolean
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
511 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
512 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
513 {
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
514 #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
515 PurpleMediaElementInfo *info;
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
516
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
517 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
518
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
519 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
520
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
521 if (info == NULL) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
522 g_object_unref(info);
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
523 return FALSE;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
524 }
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
525
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
526 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
527 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
528 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
529 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
530 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
531 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
532 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
533 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
534
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
535 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
536 manager->priv->elements, info);
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
537 g_object_unref(info);
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
538 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
539 #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
540 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
541 #endif
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
542 }
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
543
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
544 gboolean
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
545 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
546 PurpleMediaElementInfo *info)
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
547 {
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
548 #ifdef USE_VV
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
549 PurpleMediaElementInfo *info2;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
550 PurpleMediaElementType type;
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
551 gboolean ret = FALSE;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
552 gchar *id;
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
553
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
554 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
555 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
556
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
557 id = purple_media_element_info_get_id(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
558 info2 = purple_media_manager_get_element_info(manager, id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
559 g_free(id);
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
560
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
561 if (info2 == NULL)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
562 purple_media_manager_register_element(manager, info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
563 g_object_unref(info2);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
564
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
565 type = purple_media_element_info_get_element_type(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
566
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
567 if (type & PURPLE_MEDIA_ELEMENT_SRC) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
568 if (type & PURPLE_MEDIA_ELEMENT_AUDIO) {
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
569 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
570 ret = TRUE;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
571 }
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
572 if (type & PURPLE_MEDIA_ELEMENT_VIDEO) {
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
573 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
574 ret = TRUE;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
575 }
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
576 }
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
577 if (type & PURPLE_MEDIA_ELEMENT_SINK) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
578 if (type & PURPLE_MEDIA_ELEMENT_AUDIO) {
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
579 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
580 ret = TRUE;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
581 }
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
582 if (type & PURPLE_MEDIA_ELEMENT_VIDEO) {
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
583 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
584 ret = TRUE;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
585 }
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
586 }
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
587
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
588 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
589 #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
590 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
591 #endif
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
592 }
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
593
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
594 PurpleMediaElementInfo *
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
595 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
596 PurpleMediaElementType type)
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
597 {
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
598 #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
599 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
600
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
601 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
602 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
603 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
604 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
605 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
606 } 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
607 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
608 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
609 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
610 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
611 }
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
612 #endif
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
613
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
614 return NULL;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
615 }
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
616
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
617 #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
618 static void
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
619 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
620 {
26412
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
621 GstElement *sink;
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
622
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
623 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
624 !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
625 "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
626 return;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
627
26412
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
628 sink = GST_ELEMENT(GST_MESSAGE_SRC(msg));
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
629 while (sink != ow->sink) {
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
630 if (sink == NULL)
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
631 return;
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
632 sink = GST_ELEMENT_PARENT(sink);
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
633 }
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
634
26412
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
635 g_signal_handlers_disconnect_matched(bus, G_SIGNAL_MATCH_FUNC
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
636 | G_SIGNAL_MATCH_DATA, 0, 0, NULL,
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
637 window_id_cb, ow);
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
638
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
639 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
640 GST_MESSAGE_SRC(msg)), ow->window_id);
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
641 }
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
642 #endif
26117
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 gboolean
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
645 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
646 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
647 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
648 {
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
649 #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
650 GList *iter;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
651
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
652 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
653
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
654 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
655 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
656 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
657
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
658 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
659 ((participant != NULL &&
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
660 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
661 !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
662 (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
663 !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
664 GstBus *bus;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
665 GstElement *queue;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
666 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
667 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
668
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
669 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
670 continue;
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 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
673 "queue", NULL);
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
674 ow->sink = purple_media_manager_get_element(
26392
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26390
diff changeset
675 manager, PURPLE_MEDIA_RECV_VIDEO,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26390
diff changeset
676 ow->media, ow->session_id,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26390
diff changeset
677 ow->participant);
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
678
26307
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
679 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
680 /* 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
681 GObjectClass *klass =
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
682 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
683 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
684 "sync"))
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
685 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
686 "sync", "FALSE", NULL);
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
687 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
688 "async"))
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
689 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
690 "async", FALSE, NULL);
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
691 }
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
692
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
693 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
694 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
695
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
696 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
697 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
698 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
699 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
700 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
701
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
702 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
703 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
704 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
705 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
706 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
707 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
708 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
709 #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
710 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
711 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
712 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
713
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
714 gulong
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
715 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
716 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
717 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
718 {
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
719 #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
720 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
721
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
722 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
723 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
724
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
725 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
726 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
727 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
728 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
729 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
730 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
731
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
732 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
733 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
734
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
735 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
736 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
737 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
738
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
739 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
740 #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
741 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
742 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
743 }
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 gboolean
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
746 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
747 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
748 {
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
749 #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
750 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
751 GList *iter;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
752
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
753 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
754
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
755 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
756 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
757 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
758 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
759 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
760 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
761 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
762 break;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
763 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
764 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
765
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
766 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
767 return FALSE;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
768
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
769 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
770 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
771 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
772 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
773 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
774 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
775 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
776 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
777 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
778 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
779 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
780 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
781 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
782 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
783 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
784 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
785 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
786 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
787
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
788 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
789 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
790 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
791
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
792 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
793 #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
794 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
795 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
796 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
797
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
798 void
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
799 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
800 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
801 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
802 {
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
803 #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
804 GList *iter;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
805
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
806 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
807
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
808 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
809
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
810 for (; iter;) {
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
811 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
812 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
813
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
814 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
815 ((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
816 !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
817 (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
818 ((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
819 !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
820 (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
821 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
822 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
823 }
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
824 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
825 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
826
26390
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
827 void
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
828 purple_media_manager_set_ui_caps(PurpleMediaManager *manager,
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
829 PurpleMediaCaps caps)
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
830 {
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
831 #ifdef USE_VV
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
832 g_return_if_fail(PURPLE_IS_MEDIA_MANAGER(manager));
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
833 manager->priv->ui_caps = caps;
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
834 #endif
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
835 }
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
836
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
837 PurpleMediaCaps
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
838 purple_media_manager_get_ui_caps(PurpleMediaManager *manager)
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
839 {
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
840 #ifdef USE_VV
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
841 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager),
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
842 PURPLE_MEDIA_CAPS_NONE);
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
843 return manager->priv->ui_caps;
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
844 #else
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
845 return PURPLE_MEDIA_CAPS_NONE;
26390
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
846 #endif
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
847 }
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
848
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
849
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
850 /*
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
851 * PurpleMediaElementType
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
852 */
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
853
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
854 GType
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
855 purple_media_element_type_get_type()
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
856 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
857 static GType type = 0;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
858 if (type == 0) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
859 static const GFlagsValue values[] = {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
860 { PURPLE_MEDIA_ELEMENT_NONE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
861 "PURPLE_MEDIA_ELEMENT_NONE", "none" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
862 { PURPLE_MEDIA_ELEMENT_AUDIO,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
863 "PURPLE_MEDIA_ELEMENT_AUDIO", "audio" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
864 { PURPLE_MEDIA_ELEMENT_VIDEO,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
865 "PURPLE_MEDIA_ELEMENT_VIDEO", "video" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
866 { PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
867 "PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
868 "audio-video" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
869 { PURPLE_MEDIA_ELEMENT_NO_SRCS,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
870 "PURPLE_MEDIA_ELEMENT_NO_SRCS", "no-srcs" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
871 { PURPLE_MEDIA_ELEMENT_ONE_SRC,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
872 "PURPLE_MEDIA_ELEMENT_ONE_SRC", "one-src" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
873 { PURPLE_MEDIA_ELEMENT_MULTI_SRC,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
874 "PURPLE_MEDIA_ELEMENT_MULTI_SRC",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
875 "multi-src" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
876 { PURPLE_MEDIA_ELEMENT_REQUEST_SRC,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
877 "PURPLE_MEDIA_ELEMENT_REQUEST_SRC",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
878 "request-src" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
879 { PURPLE_MEDIA_ELEMENT_NO_SINKS,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
880 "PURPLE_MEDIA_ELEMENT_NO_SINKS", "no-sinks" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
881 { PURPLE_MEDIA_ELEMENT_ONE_SINK,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
882 "PURPLE_MEDIA_ELEMENT_ONE_SINK", "one-sink" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
883 { PURPLE_MEDIA_ELEMENT_MULTI_SINK,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
884 "PURPLE_MEDIA_ELEMENT_MULTI_SINK",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
885 "multi-sink" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
886 { PURPLE_MEDIA_ELEMENT_REQUEST_SINK,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
887 "PURPLE_MEDIA_ELEMENT_REQUEST_SINK",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
888 "request-sink" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
889 { PURPLE_MEDIA_ELEMENT_UNIQUE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
890 "PURPLE_MEDIA_ELEMENT_UNIQUE", "unique" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
891 { PURPLE_MEDIA_ELEMENT_SRC,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
892 "PURPLE_MEDIA_ELEMENT_SRC", "src" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
893 { PURPLE_MEDIA_ELEMENT_SINK,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
894 "PURPLE_MEDIA_ELEMENT_SINK", "sink" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
895 { 0, NULL, NULL }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
896 };
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
897 type = g_flags_register_static(
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
898 "PurpleMediaElementType", values);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
899 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
900 return type;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
901 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
902
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
903 /*
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
904 * PurpleMediaElementInfo
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
905 */
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
906
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
907 struct _PurpleMediaElementInfoClass
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
908 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
909 GObjectClass parent_class;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
910 };
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
911
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
912 struct _PurpleMediaElementInfo
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
913 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
914 GObject parent;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
915 };
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
916
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
917 #ifdef USE_VV
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
918 struct _PurpleMediaElementInfoPrivate
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
919 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
920 gchar *id;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
921 gchar *name;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
922 PurpleMediaElementType type;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
923 PurpleMediaElementCreateCallback create;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
924 };
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
925
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
926 enum {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
927 PROP_0,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
928 PROP_ID,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
929 PROP_NAME,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
930 PROP_TYPE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
931 PROP_CREATE_CB,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
932 };
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
933
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
934 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
935 purple_media_element_info_init(PurpleMediaElementInfo *info)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
936 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
937 PurpleMediaElementInfoPrivate *priv =
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
938 PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
939 priv->id = NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
940 priv->name = NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
941 priv->type = PURPLE_MEDIA_ELEMENT_NONE;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
942 priv->create = NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
943 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
944
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
945 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
946 purple_media_element_info_finalize(GObject *info)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
947 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
948 PurpleMediaElementInfoPrivate *priv =
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
949 PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
950 g_free(priv->id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
951 g_free(priv->name);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
952 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
953
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
954 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
955 purple_media_element_info_set_property (GObject *object, guint prop_id,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
956 const GValue *value, GParamSpec *pspec)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
957 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
958 PurpleMediaElementInfoPrivate *priv;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
959 g_return_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(object));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
960
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
961 priv = PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(object);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
962
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
963 switch (prop_id) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
964 case PROP_ID:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
965 g_free(priv->id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
966 priv->id = g_value_dup_string(value);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
967 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
968 case PROP_NAME:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
969 g_free(priv->name);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
970 priv->name = g_value_dup_string(value);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
971 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
972 case PROP_TYPE: {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
973 priv->type = g_value_get_flags(value);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
974 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
975 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
976 case PROP_CREATE_CB:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
977 priv->create = g_value_get_pointer(value);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
978 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
979 default:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
980 G_OBJECT_WARN_INVALID_PROPERTY_ID(
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
981 object, prop_id, pspec);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
982 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
983 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
984 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
985
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
986 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
987 purple_media_element_info_get_property (GObject *object, guint prop_id,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
988 GValue *value, GParamSpec *pspec)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
989 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
990 PurpleMediaElementInfoPrivate *priv;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
991 g_return_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(object));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
992
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
993 priv = PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(object);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
994
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
995 switch (prop_id) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
996 case PROP_ID:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
997 g_value_set_string(value, priv->id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
998 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
999 case PROP_NAME:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1000 g_value_set_string(value, priv->name);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1001 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1002 case PROP_TYPE:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1003 g_value_set_flags(value, priv->type);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1004 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1005 case PROP_CREATE_CB:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1006 g_value_set_pointer(value, priv->create);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1007 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1008 default:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1009 G_OBJECT_WARN_INVALID_PROPERTY_ID(
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1010 object, prop_id, pspec);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1011 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1012 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1013 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1014
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1015 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1016 purple_media_element_info_class_init(PurpleMediaElementInfoClass *klass)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1017 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1018 GObjectClass *gobject_class = (GObjectClass*)klass;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1019
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1020 gobject_class->finalize = purple_media_element_info_finalize;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1021 gobject_class->set_property = purple_media_element_info_set_property;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1022 gobject_class->get_property = purple_media_element_info_get_property;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1023
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1024 g_object_class_install_property(gobject_class, PROP_ID,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1025 g_param_spec_string("id",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1026 "ID",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1027 "The unique identifier of the element.",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1028 NULL,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1029 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1030
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1031 g_object_class_install_property(gobject_class, PROP_NAME,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1032 g_param_spec_string("name",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1033 "Name",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1034 "The friendly/display name of this element.",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1035 NULL,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1036 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1037
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1038 g_object_class_install_property(gobject_class, PROP_TYPE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1039 g_param_spec_flags("type",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1040 "Element Type",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1041 "The type of element this is.",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1042 PURPLE_TYPE_MEDIA_ELEMENT_TYPE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1043 PURPLE_MEDIA_ELEMENT_NONE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1044 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1045
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1046 g_object_class_install_property(gobject_class, PROP_CREATE_CB,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1047 g_param_spec_pointer("create-cb",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1048 "Create Callback",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1049 "The function called to create this element.",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1050 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1051
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1052 g_type_class_add_private(klass, sizeof(PurpleMediaElementInfoPrivate));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1053 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1054
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1055 G_DEFINE_TYPE(PurpleMediaElementInfo,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1056 purple_media_element_info, G_TYPE_OBJECT);
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1057 #else
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1058 GType
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1059 purple_media_element_info_get_type()
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1060 {
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1061 return G_TYPE_NONE;
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1062 }
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1063 #endif
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1064
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1065 gchar *
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1066 purple_media_element_info_get_id(PurpleMediaElementInfo *info)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1067 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1068 #ifdef USE_VV
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1069 gchar *id;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1070 g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1071 g_object_get(info, "id", &id, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1072 return id;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1073 #else
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1074 return NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1075 #endif
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1076 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1077
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1078 gchar *
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1079 purple_media_element_info_get_name(PurpleMediaElementInfo *info)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1080 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1081 #ifdef USE_VV
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1082 gchar *name;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1083 g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1084 g_object_get(info, "name", &name, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1085 return name;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1086 #else
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1087 return NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1088 #endif
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1089 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1090
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1091 PurpleMediaElementType
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1092 purple_media_element_info_get_element_type(PurpleMediaElementInfo *info)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1093 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1094 #ifdef USE_VV
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1095 PurpleMediaElementType type;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1096 g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info),
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1097 PURPLE_MEDIA_ELEMENT_NONE);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1098 g_object_get(info, "type", &type, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1099 return type;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1100 #else
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1101 return PURPLE_MEDIA_ELEMENT_NONE;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1102 #endif
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1103 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1104
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1105 GstElement *
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1106 purple_media_element_info_call_create(PurpleMediaElementInfo *info,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1107 PurpleMedia *media, const gchar *session_id,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1108 const gchar *participant)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1109 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1110 #ifdef USE_VV
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1111 PurpleMediaElementCreateCallback create;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1112 g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1113 g_object_get(info, "create-cb", &create, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1114 if (create)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1115 return create(media, session_id, participant);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1116 #endif
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1117 return NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1118 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1119