annotate libpurple/mediamanager.c @ 27034:b58672890b3f

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