annotate libpurple/mediamanager.c @ 31479:0eceb1304f53

Add new DNS-related API to perform lookups in the context of an account. Combined with the new "Tor/Privacy" proxy setting, this allows us to prevent DNS lookups when the user has selected a proxy that they may want to use to for privacy. Refs #11110
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 19 Apr 2011 04:58:17 +0000
parents d72d728226dc
children fd1b4bbefc6b
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
28047
8c991e09efcb Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents: 27885
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23760
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
29210
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
40 #include <media/backend-fs2.h>
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
27833
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
42 #include <gst/farsight/fs-element-added-notifier.h>
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
43 #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
44
26400
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
45 /** @copydoc _PurpleMediaManagerPrivate */
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
46 typedef struct _PurpleMediaManagerPrivate PurpleMediaManagerPrivate;
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
47 /** @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
48 typedef struct _PurpleMediaOutputWindow PurpleMediaOutputWindow;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
49 /** @copydoc _PurpleMediaManagerPrivate */
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
50 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
51
26400
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
52 /** The media manager class. */
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
53 struct _PurpleMediaManagerClass
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
54 {
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
55 GObjectClass parent_class; /**< The parent class. */
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
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
58 /** The media manager's data. */
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
59 struct _PurpleMediaManager
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
60 {
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
61 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
62 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
63 };
84d09c6499f1 Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
64
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
65 struct _PurpleMediaOutputWindow
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
66 {
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
67 gulong id;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
68 PurpleMedia *media;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
69 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
70 gchar *participant;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
71 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
72 GstElement *sink;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
73 };
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 struct _PurpleMediaManagerPrivate
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 {
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
77 GstElement *pipeline;
26390
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
78 PurpleMediaCaps ui_caps;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 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
80 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
81 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
82 gulong next_output_window_id;
29210
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
83 GType backend_type;
31103
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
84 GstCaps *video_caps;
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
85
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
86 PurpleMediaElementInfo *video_src;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
87 PurpleMediaElementInfo *video_sink;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
88 PurpleMediaElementInfo *audio_src;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
89 PurpleMediaElementInfo *audio_sink;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 #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
93 #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
94
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 static void purple_media_manager_class_init (PurpleMediaManagerClass *klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 static void purple_media_manager_init (PurpleMediaManager *media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 static void purple_media_manager_finalize (GObject *object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 static GObjectClass *parent_class = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 enum {
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23761
diff changeset
104 INIT_MEDIA,
29131
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
105 UI_CAPS_CHANGED,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 LAST_SIGNAL
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 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
109 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 GType
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 purple_media_manager_get_type()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 {
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
114 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 static GType type = 0;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 if (type == 0) {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 static const GTypeInfo info = {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 sizeof(PurpleMediaManagerClass),
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 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 (GClassInitFunc) purple_media_manager_class_init,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 sizeof(PurpleMediaManager),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 0,
23772
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
127 (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
128 NULL
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 return type;
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
133 #else
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
134 return G_TYPE_NONE;
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
135 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
138 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 purple_media_manager_class_init (PurpleMediaManagerClass *klass)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 GObjectClass *gobject_class = (GObjectClass*)klass;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 parent_class = g_type_class_peek_parent(klass);
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 29210
diff changeset
144
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 gobject_class->finalize = purple_media_manager_finalize;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23761
diff changeset
147 purple_media_manager_signals[INIT_MEDIA] = g_signal_new ("init-media",
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 G_TYPE_FROM_CLASS (klass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 G_SIGNAL_RUN_LAST,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 0, NULL, NULL,
24983
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
151 purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING,
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
152 G_TYPE_BOOLEAN, 3, PURPLE_TYPE_MEDIA,
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
153 G_TYPE_POINTER, G_TYPE_STRING);
29131
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
154
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
155 purple_media_manager_signals[UI_CAPS_CHANGED] = g_signal_new ("ui-caps-changed",
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
156 G_TYPE_FROM_CLASS (klass),
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
157 G_SIGNAL_RUN_LAST,
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
158 0, NULL, NULL,
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
159 purple_smarshal_VOID__FLAGS_FLAGS,
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
160 G_TYPE_NONE, 2, PURPLE_MEDIA_TYPE_CAPS,
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
161 PURPLE_MEDIA_TYPE_CAPS);
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
162
23761
2fda71133800 Some UI ;)
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
163 g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 purple_media_manager_init (PurpleMediaManager *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media);
23761
2fda71133800 Some UI ;)
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
170 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
171 media->priv->next_output_window_id = 1;
29210
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
172 #ifdef USE_VV
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
173 media->priv->backend_type = PURPLE_TYPE_MEDIA_BACKEND_FS2;
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
174 #endif
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27834
diff changeset
175
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27834
diff changeset
176 purple_prefs_add_none("/purple/media");
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27834
diff changeset
177 purple_prefs_add_none("/purple/media/audio");
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
178 purple_prefs_add_int("/purple/media/audio/silence_threshold", 5);
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27834
diff changeset
179 purple_prefs_add_none("/purple/media/audio/volume");
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27834
diff changeset
180 purple_prefs_add_int("/purple/media/audio/volume/input", 10);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27834
diff changeset
181 purple_prefs_add_int("/purple/media/audio/volume/output", 10);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 purple_media_manager_finalize (GObject *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 {
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
187 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
188 for (; priv->medias; priv->medias =
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
189 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
190 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
191 }
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
192 for (; priv->elements; priv->elements =
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
193 g_list_delete_link(priv->elements, priv->elements)) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
194 g_object_unref(priv->elements->data);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
195 }
31103
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
196 if (priv->video_caps)
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
197 gst_caps_unref(priv->video_caps);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 parent_class->finalize(media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 }
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
200 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 PurpleMediaManager *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 purple_media_manager_get()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 {
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
205 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 static PurpleMediaManager *manager = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 if (manager == NULL)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL));
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 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
211 #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
212 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
213 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
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
216 #ifdef USE_VV
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
217 static gboolean
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
218 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
219 {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
220 switch(GST_MESSAGE_TYPE(msg)) {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
221 case GST_MESSAGE_EOS:
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
222 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
223 break;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
224 case GST_MESSAGE_ERROR: {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
225 gchar *debug = NULL;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
226 GError *err = NULL;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
227
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
228 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
229
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
230 purple_debug_error("mediamanager",
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
231 "gst pipeline error: %s\n",
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
232 err->message);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
233 g_error_free(err);
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 if (debug) {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
236 purple_debug_error("mediamanager",
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
237 "Debug details: %s\n", debug);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
238 g_free (debug);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
239 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
240 break;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
241 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
242 default:
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
243 break;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
244 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
245 return TRUE;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
246 }
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
247 #endif
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
248
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26526
diff changeset
249 #ifdef USE_GSTREAMER
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
250 GstElement *
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
251 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
252 {
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
253 #ifdef USE_VV
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
254 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
255
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
256 if (manager->priv->pipeline == NULL) {
27834
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
257 FsElementAddedNotifier *notifier;
27833
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
258 gchar *filename;
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
259 GError *err = NULL;
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
260 GKeyFile *keyfile;
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
261 GstBus *bus;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
262 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
263
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
264 bus = gst_pipeline_get_bus(
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
265 GST_PIPELINE(manager->priv->pipeline));
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
266 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
267 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
268 G_CALLBACK(pipeline_bus_call), manager);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
269 gst_bus_set_sync_handler(bus,
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
270 gst_bus_sync_signal_handler, NULL);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
271 gst_object_unref(bus);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
272
27833
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
273 filename = g_build_filename(purple_user_dir(),
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
274 "fs-element.conf", NULL);
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
275 keyfile = g_key_file_new();
27834
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
276 if (!g_key_file_load_from_file(keyfile, filename,
27833
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
277 G_KEY_FILE_NONE, &err)) {
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
278 if (err->code == 4)
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
279 purple_debug_info("mediamanager",
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
280 "Couldn't read "
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
281 "fs-element.conf: %s\n",
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
282 err->message);
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
283 else
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
284 purple_debug_error("mediamanager",
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
285 "Error reading "
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
286 "fs-element.conf: %s\n",
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
287 err->message);
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
288 g_error_free(err);
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
289 }
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
290 g_free(filename);
6ed9c1def7c8 Allow setting properties on GStreamer elements with fs-element.conf.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27662
diff changeset
291
27834
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
292 /* Hack to make alsasrc stop messing up audio timestamps */
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
293 if (!g_key_file_has_key(keyfile,
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
294 "alsasrc", "slave-method", NULL)) {
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
295 g_key_file_set_integer(keyfile,
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
296 "alsasrc", "slave-method", 2);
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
297 }
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
298
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
299 notifier = fs_element_added_notifier_new();
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
300 fs_element_added_notifier_add(notifier,
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
301 GST_BIN(manager->priv->pipeline));
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
302 fs_element_added_notifier_set_properties_from_keyfile(
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
303 notifier, keyfile);
fa2e83d7ba7f Set alsasrc's slave-method to 2. This stops the audio timestamps from
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27833
diff changeset
304
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
305 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
306 GST_STATE_PLAYING);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
307 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
308
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
309 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
310 #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
311 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
312 #endif
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
313 }
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26526
diff changeset
314 #endif /* USE_GSTREAMER */
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
315
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
316 PurpleMedia *
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
317 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
318 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
319 const char *conference_type,
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
320 const char *remote_user,
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
321 gboolean initiator)
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
323 #ifdef USE_VV
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
324 PurpleMedia *media;
23872
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
325 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
326
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
327 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
328 "manager", manager,
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
329 "account", account,
29155
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29131
diff changeset
330 "conference-type", conference_type,
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
331 "initiator", initiator,
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
332 NULL));
23856
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
333
23872
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
334 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
335 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
336
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
337 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
338 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
339 return NULL;
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
340 }
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
341
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 manager->priv->medias = g_list_append(manager->priv->medias, media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 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
344 #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
345 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
346 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
349 GList *
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
350 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
351 {
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
352 #ifdef USE_VV
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
353 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
354 #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
355 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
356 #endif
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
357 }
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
358
26123
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
359 GList *
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
360 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
361 PurpleAccount *account)
26123
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
362 {
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
363 #ifdef USE_VV
26123
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
364 GList *media = NULL;
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
365 GList *iter;
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
366
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
367 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
368
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
369 iter = manager->priv->medias;
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
370 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
371 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
372 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
373 }
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
374 }
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
375
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
376 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
377 #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
378 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
379 #endif
26123
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
380 }
75a02ffb0139 Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
381
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
382 void
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
383 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
384 PurpleMedia *media)
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
385 {
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
386 #ifdef USE_VV
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
387 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
388 if (list)
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
389 manager->priv->medias =
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
390 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
391 #endif
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
392 }
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
393
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
394 #ifdef USE_VV
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
395 static void
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
396 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
397 {
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
398 GstElement *parent = GST_ELEMENT_PARENT(pad);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
399 GstIterator *iter;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
400 GstPad *remaining_pad;
27856
1c58b9d2429b Unleak pad if more pads are linked.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
401 GstIteratorResult result;
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
402
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
403 gst_element_release_request_pad(GST_ELEMENT_PARENT(pad), pad);
31105
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31103
diff changeset
404
27856
1c58b9d2429b Unleak pad if more pads are linked.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
405 iter = gst_element_iterate_src_pads(parent);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
406
27856
1c58b9d2429b Unleak pad if more pads are linked.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
407 result = gst_iterator_next(iter, (gpointer)&remaining_pad);
1c58b9d2429b Unleak pad if more pads are linked.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
408
1c58b9d2429b Unleak pad if more pads are linked.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
409 if (result == GST_ITERATOR_DONE) {
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
410 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
411 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
412 gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(parent)), parent);
27856
1c58b9d2429b Unleak pad if more pads are linked.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
413 } else if (result == GST_ITERATOR_OK) {
1c58b9d2429b Unleak pad if more pads are linked.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
414 gst_object_unref(remaining_pad);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
415 }
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
416
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
417 gst_iterator_free(iter);
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 #endif
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
420
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26526
diff changeset
421 #ifdef USE_GSTREAMER
31103
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
422
31365
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
423 void
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
424 purple_media_manager_set_video_caps(PurpleMediaManager *manager, GstCaps *caps)
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
425 {
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
426 #ifdef USE_VV
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
427 if (manager->priv->video_caps)
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
428 gst_caps_unref(manager->priv->video_caps);
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
429
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
430 manager->priv->video_caps = caps;
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
431
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
432 if (manager->priv->pipeline && manager->priv->video_src) {
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
433 gchar *id = purple_media_element_info_get_id(manager->priv->video_src);
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
434 GstElement *src = gst_bin_get_by_name(GST_BIN(manager->priv->pipeline), id);
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
435
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
436 if (src) {
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
437 GstElement *capsfilter = gst_bin_get_by_name(GST_BIN(src), "prpl_video_caps");
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
438 g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL);
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
439 }
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
440
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
441 g_free(id);
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
442 }
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
443 #endif
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
444 }
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
445
55e30c0eca22 Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
jakub.adam@ktknet.cz
parents: 31105
diff changeset
446 GstCaps *
31103
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
447 purple_media_manager_get_video_caps(PurpleMediaManager *manager)
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
448 {
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
449 #ifdef USE_VV
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
450 if (manager->priv->video_caps == NULL)
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
451 manager->priv->video_caps = gst_caps_from_string("video/x-raw-yuv,"
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
452 "width=[250,352], height=[200,288], framerate=[1/1,20/1]");
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
453 return manager->priv->video_caps;
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
454 #else
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
455 return NULL;
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
456 #endif
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
457 }
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
458
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
459 GstElement *
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
460 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
461 PurpleMediaSessionType type, PurpleMedia *media,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26390
diff changeset
462 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
463 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
464 #ifdef USE_VV
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
465 GstElement *ret = NULL;
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
466 PurpleMediaElementInfo *info = NULL;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
467 PurpleMediaElementType element_type;
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
468
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
469 if (type & PURPLE_MEDIA_SEND_AUDIO)
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
470 info = manager->priv->audio_src;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
471 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
472 info = manager->priv->audio_sink;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
473 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
474 info = manager->priv->video_src;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
475 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
476 info = manager->priv->video_sink;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
477
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
478 if (info == NULL)
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
479 return NULL;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
480
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
481 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
482
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
483 if (element_type & PURPLE_MEDIA_ELEMENT_UNIQUE &&
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
484 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
485 GstElement *tee;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
486 GstPad *pad;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
487 GstPad *ghost;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
488 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
489
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
490 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
491 purple_media_manager_get_pipeline(
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
492 manager)), id);
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
493
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
494 if (ret == NULL) {
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
495 GstElement *bin, *fakesink;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
496 ret = purple_media_element_info_call_create(info,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
497 media, session_id, participant);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
498 bin = gst_bin_new(id);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
499 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
500 gst_bin_add_many(GST_BIN(bin), ret, tee, NULL);
31103
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
501
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
502 if (type & PURPLE_MEDIA_SEND_VIDEO) {
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
503 GstElement *videoscale;
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
504 GstElement *capsfilter;
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
505
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
506 videoscale = gst_element_factory_make("videoscale", NULL);
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
507 capsfilter = gst_element_factory_make("capsfilter", "prpl_video_caps");
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
508
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
509 g_object_set(G_OBJECT(capsfilter),
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
510 "caps", purple_media_manager_get_video_caps(manager), NULL);
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
511
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
512 gst_bin_add_many(GST_BIN(bin), videoscale, capsfilter, NULL);
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
513 gst_element_link_many(ret, videoscale, capsfilter, tee, NULL);
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
514 } else
4ce69a55f2c6 Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
515 gst_element_link(ret, tee);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
516
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
517 /*
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
518 * 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
519 * 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
520 */
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
521 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
522 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
523 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
524 gst_element_link(tee, fakesink);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
525
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
526 ret = bin;
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
527 gst_object_ref(ret);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
528 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
529 manager)), ret);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
530 }
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
531 g_free(id);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
532
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
533 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
534 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
535 gst_object_unref(tee);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
536 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
537 gst_object_unref(pad);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
538 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
539 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
540 gst_pad_set_active(ghost, TRUE);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
541 gst_element_add_pad(ret, ghost);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
542 } else {
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
543 ret = purple_media_element_info_call_create(info,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
544 media, session_id, participant);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26350
diff changeset
545 }
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
546
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
547 if (ret == NULL)
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
548 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
549
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
550 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
551 #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
552 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
553 #endif
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
554 }
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
555
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
556 PurpleMediaElementInfo *
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
557 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
558 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
559 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
560 #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
561 GList *iter;
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
562
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
563 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
564
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
565 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
566
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
567 for (; iter; iter = g_list_next(iter)) {
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
568 gchar *element_id =
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
569 purple_media_element_info_get_id(iter->data);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
570 if (!strcmp(element_id, id)) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
571 g_free(element_id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
572 g_object_ref(iter->data);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
573 return iter->data;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
574 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
575 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
576 }
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
577 #endif
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
578
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
579 return NULL;
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
580 }
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
581
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
582 gboolean
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
583 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
584 PurpleMediaElementInfo *info)
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
585 {
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
586 #ifdef USE_VV
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
587 PurpleMediaElementInfo *info2;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
588 gchar *id;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
589
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
590 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
591 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
592
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
593 id = purple_media_element_info_get_id(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
594 info2 = purple_media_manager_get_element_info(manager, id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
595 g_free(id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
596
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
597 if (info2 != NULL) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
598 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
599 return FALSE;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
600 }
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
601
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
602 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
603 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
604 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
605 #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
606 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
607 #endif
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
608 }
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
609
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
610 gboolean
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
611 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
612 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
613 {
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
614 #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
615 PurpleMediaElementInfo *info;
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
616
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
617 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
618
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
619 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
620
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
621 if (info == NULL) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
622 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
623 return FALSE;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
624 }
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
625
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
626 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
627 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
628 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
629 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
630 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
631 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
632 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
633 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
634
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
635 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
636 manager->priv->elements, info);
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
637 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
638 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
639 #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
640 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
641 #endif
26081
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
642 }
521366dfd8db Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
643
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
644 gboolean
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
645 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
646 PurpleMediaElementInfo *info)
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
647 {
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
648 #ifdef USE_VV
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
649 PurpleMediaElementInfo *info2;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
650 PurpleMediaElementType type;
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
651 gboolean ret = FALSE;
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
652 gchar *id;
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
653
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
654 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
655 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
656
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
657 id = purple_media_element_info_get_id(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
658 info2 = purple_media_manager_get_element_info(manager, id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
659 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
660
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
661 if (info2 == NULL)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
662 purple_media_manager_register_element(manager, info);
26526
082a97307b8d Fix some assertions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26524
diff changeset
663 else
082a97307b8d Fix some assertions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26524
diff changeset
664 g_object_unref(info2);
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
665
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
666 type = purple_media_element_info_get_element_type(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
667
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
668 if (type & PURPLE_MEDIA_ELEMENT_SRC) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
669 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
670 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
671 ret = TRUE;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
672 }
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
673 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
674 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
675 ret = TRUE;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
676 }
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
677 }
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
678 if (type & PURPLE_MEDIA_ELEMENT_SINK) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
679 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
680 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
681 ret = TRUE;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
682 }
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
683 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
684 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
685 ret = TRUE;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
686 }
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
687 }
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
688
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
689 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
690 #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
691 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
692 #endif
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
693 }
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
694
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
695 PurpleMediaElementInfo *
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
696 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
697 PurpleMediaElementType type)
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
698 {
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
699 #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
700 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
701
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
702 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
703 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
704 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
705 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
706 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
707 } 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
708 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
709 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
710 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
711 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
712 }
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
713 #endif
26083
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
714
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
715 return NULL;
0e8814c437b2 Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26081
diff changeset
716 }
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26526
diff changeset
717 #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
718
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
719 #ifdef USE_VV
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
720 static void
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
721 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
722 {
26412
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
723 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
724
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
725 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
726 !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
727 "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
728 return;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
729
26412
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
730 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
731 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
732 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
733 return;
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
734 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
735 }
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
736
26412
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
737 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
738 | 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
739 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
740
86c5499f36e8 Fix embedding video when the sink is a gconfvideosrc pointing to an
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
741 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
742 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
743 }
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
744 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
745
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
746 gboolean
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
747 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
748 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
749 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
750 {
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
751 #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
752 GList *iter;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
753
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
754 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
755
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
756 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
757 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
758 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
759
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
760 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
761 ((participant != NULL &&
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
762 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
763 !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
764 (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
765 !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
766 GstBus *bus;
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
767 GstElement *queue, *colorspace;
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
768 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
769 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
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 (tee == NULL)
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
772 continue;
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 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
775 "queue", NULL);
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
776 colorspace = gst_element_factory_make(
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
777 "ffmpegcolorspace", NULL);
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
778 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
779 manager, PURPLE_MEDIA_RECV_VIDEO,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26390
diff changeset
780 ow->media, ow->session_id,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26390
diff changeset
781 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
782
26307
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
783 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
784 /* 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
785 GObjectClass *klass =
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
786 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
787 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
788 "sync"))
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
789 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
790 "sync", "FALSE", NULL);
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
791 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
792 "async"))
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
793 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
794 "async", FALSE, NULL);
5ee7e8f209bb Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26123
diff changeset
795 }
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
796
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
797 gst_bin_add_many(GST_BIN(GST_ELEMENT_PARENT(tee)),
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
798 queue, colorspace, ow->sink, NULL);
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
799
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
800 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
801 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
802 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
803 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
804 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
805
27882
d865064a3104 Switch around some GStreamer linking and state setting.
maiku@pidgin.im
parents: 27856
diff changeset
806 gst_element_set_state(ow->sink, GST_STATE_PLAYING);
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
807 gst_element_set_state(colorspace, GST_STATE_PLAYING);
27882
d865064a3104 Switch around some GStreamer linking and state setting.
maiku@pidgin.im
parents: 27856
diff changeset
808 gst_element_set_state(queue, GST_STATE_PLAYING);
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
809 gst_element_link(colorspace, ow->sink);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
810 gst_element_link(queue, colorspace);
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
811 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
812 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
813 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
814 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
815 #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
816 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
817 #endif
26117
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
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
820 gulong
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
821 purple_media_manager_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
822 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
823 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
824 {
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
825 #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
826 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
827
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
828 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
829 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
830
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
831 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
832 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
833 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
834 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
835 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
836 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
837
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
838 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
839 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
840
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
841 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
842 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
843 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
844
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
845 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
846 #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
847 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
848 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
849 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
850
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
851 gboolean
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
852 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
853 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
854 {
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
855 #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
856 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
857 GList *iter;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
858
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
859 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
860
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
861 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
862 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
863 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
864 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
865 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
866 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
867 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
868 break;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
869 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
870 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
871
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
872 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
873 return FALSE;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
874
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
875 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
876 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
877 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
878 GstPad *peer = gst_pad_get_peer(pad);
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
879 GstElement *colorspace = GST_ELEMENT_PARENT(peer), *queue;
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
880 gst_object_unref(pad);
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
881 gst_object_unref(peer);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
882 pad = gst_element_get_static_pad(colorspace, "sink");
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
883 peer = gst_pad_get_peer(pad);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
884 queue = GST_ELEMENT_PARENT(peer);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
885 gst_object_unref(pad);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
886 gst_object_unref(peer);
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
887 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
888 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
889 gst_object_unref(pad);
27662
feb17f2b5b7a Don't crash when there isn't a webcam connected.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26563
diff changeset
890 if (peer != NULL)
feb17f2b5b7a Don't crash when there isn't a webcam connected.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26563
diff changeset
891 gst_element_release_request_pad(GST_ELEMENT_PARENT(peer), peer);
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
892 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
893 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
894 gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(queue)), queue);
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
895 gst_element_set_locked_state(colorspace, TRUE);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
896 gst_element_set_state(colorspace, GST_STATE_NULL);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
897 gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(colorspace)), colorspace);
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
898 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
899 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
900 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
901 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
902 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
903
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
904 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
905 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
906 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
907
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
908 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
909 #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
910 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
911 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
912 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
913
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
914 void
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
915 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
916 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
917 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
918 {
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
919 #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
920 GList *iter;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
921
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
922 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
923
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
924 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
925
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
926 for (; iter;) {
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
927 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
928 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
929
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
930 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
931 ((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
932 !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
933 (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
934 ((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
935 !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
936 (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
937 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
938 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
939 }
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
940 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
941 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
942
26390
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
943 void
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
944 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
945 PurpleMediaCaps caps)
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
946 {
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
947 #ifdef USE_VV
29131
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
948 PurpleMediaCaps oldcaps;
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
949
26390
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
950 g_return_if_fail(PURPLE_IS_MEDIA_MANAGER(manager));
29131
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
951
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
952 oldcaps = manager->priv->ui_caps;
26390
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
953 manager->priv->ui_caps = caps;
29131
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
954
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
955 if (caps != oldcaps)
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
956 g_signal_emit(manager,
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
957 purple_media_manager_signals[UI_CAPS_CHANGED],
e144a461cf3c Added the ui-caps-changed signal to the media manager.
maiku@pidgin.im
parents: 28047
diff changeset
958 0, caps, oldcaps);
26390
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
959 #endif
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
960 }
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
961
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
962 PurpleMediaCaps
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
963 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
964 {
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
965 #ifdef USE_VV
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
966 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
967 PURPLE_MEDIA_CAPS_NONE);
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
968 return manager->priv->ui_caps;
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
969 #else
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
970 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
971 #endif
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
972 }
507d2366d329 Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26381
diff changeset
973
29210
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
974 void
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
975 purple_media_manager_set_backend_type(PurpleMediaManager *manager,
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
976 GType backend_type)
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
977 {
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
978 #ifdef USE_VV
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
979 g_return_if_fail(PURPLE_IS_MEDIA_MANAGER(manager));
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
980
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
981 manager->priv->backend_type = backend_type;
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
982 #endif
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
983 }
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
984
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
985 GType
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
986 purple_media_manager_get_backend_type(PurpleMediaManager *manager)
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 29210
diff changeset
987 {
29210
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
988 #ifdef USE_VV
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
989 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager),
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
990 PURPLE_MEDIA_CAPS_NONE);
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
991
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
992 return manager->priv->backend_type;
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
993 #else
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
994 return G_TYPE_NONE;
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
995 #endif
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
996 }
2b2b930281a0 Add a way to set and get which media backend type to use.
maiku@pidgin.im
parents: 29155
diff changeset
997
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26526
diff changeset
998 #ifdef USE_GSTREAMER
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
999
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 * PurpleMediaElementType
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1002 */
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1003
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1004 GType
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1005 purple_media_element_type_get_type()
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1006 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1007 static GType type = 0;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1008 if (type == 0) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1009 static const GFlagsValue values[] = {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1010 { PURPLE_MEDIA_ELEMENT_NONE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1011 "PURPLE_MEDIA_ELEMENT_NONE", "none" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1012 { PURPLE_MEDIA_ELEMENT_AUDIO,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1013 "PURPLE_MEDIA_ELEMENT_AUDIO", "audio" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1014 { PURPLE_MEDIA_ELEMENT_VIDEO,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1015 "PURPLE_MEDIA_ELEMENT_VIDEO", "video" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1016 { PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1017 "PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1018 "audio-video" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1019 { PURPLE_MEDIA_ELEMENT_NO_SRCS,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1020 "PURPLE_MEDIA_ELEMENT_NO_SRCS", "no-srcs" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1021 { PURPLE_MEDIA_ELEMENT_ONE_SRC,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1022 "PURPLE_MEDIA_ELEMENT_ONE_SRC", "one-src" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1023 { PURPLE_MEDIA_ELEMENT_MULTI_SRC,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1024 "PURPLE_MEDIA_ELEMENT_MULTI_SRC",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1025 "multi-src" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1026 { PURPLE_MEDIA_ELEMENT_REQUEST_SRC,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1027 "PURPLE_MEDIA_ELEMENT_REQUEST_SRC",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1028 "request-src" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1029 { PURPLE_MEDIA_ELEMENT_NO_SINKS,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1030 "PURPLE_MEDIA_ELEMENT_NO_SINKS", "no-sinks" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1031 { PURPLE_MEDIA_ELEMENT_ONE_SINK,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1032 "PURPLE_MEDIA_ELEMENT_ONE_SINK", "one-sink" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1033 { PURPLE_MEDIA_ELEMENT_MULTI_SINK,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1034 "PURPLE_MEDIA_ELEMENT_MULTI_SINK",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1035 "multi-sink" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1036 { PURPLE_MEDIA_ELEMENT_REQUEST_SINK,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1037 "PURPLE_MEDIA_ELEMENT_REQUEST_SINK",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1038 "request-sink" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1039 { PURPLE_MEDIA_ELEMENT_UNIQUE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1040 "PURPLE_MEDIA_ELEMENT_UNIQUE", "unique" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1041 { PURPLE_MEDIA_ELEMENT_SRC,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1042 "PURPLE_MEDIA_ELEMENT_SRC", "src" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1043 { PURPLE_MEDIA_ELEMENT_SINK,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1044 "PURPLE_MEDIA_ELEMENT_SINK", "sink" },
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1045 { 0, NULL, NULL }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1046 };
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1047 type = g_flags_register_static(
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1048 "PurpleMediaElementType", values);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1049 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1050 return type;
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
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1053 /*
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1054 * PurpleMediaElementInfo
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1055 */
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1056
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1057 struct _PurpleMediaElementInfoClass
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1058 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1059 GObjectClass parent_class;
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
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1062 struct _PurpleMediaElementInfo
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1063 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1064 GObject parent;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1065 };
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1066
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1067 #ifdef USE_VV
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1068 struct _PurpleMediaElementInfoPrivate
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1069 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1070 gchar *id;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1071 gchar *name;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1072 PurpleMediaElementType type;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1073 PurpleMediaElementCreateCallback create;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1074 };
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1075
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1076 enum {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1077 PROP_0,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1078 PROP_ID,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1079 PROP_NAME,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1080 PROP_TYPE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1081 PROP_CREATE_CB,
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 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1085 purple_media_element_info_init(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 PurpleMediaElementInfoPrivate *priv =
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1088 PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1089 priv->id = NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1090 priv->name = NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1091 priv->type = PURPLE_MEDIA_ELEMENT_NONE;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1092 priv->create = NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1093 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1094
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1095 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1096 purple_media_element_info_finalize(GObject *info)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1097 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1098 PurpleMediaElementInfoPrivate *priv =
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1099 PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(info);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1100 g_free(priv->id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1101 g_free(priv->name);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1102 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1103
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1104 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1105 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
1106 const GValue *value, GParamSpec *pspec)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1107 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1108 PurpleMediaElementInfoPrivate *priv;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1109 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
1110
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1111 priv = PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(object);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1112
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1113 switch (prop_id) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1114 case PROP_ID:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1115 g_free(priv->id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1116 priv->id = g_value_dup_string(value);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1117 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1118 case PROP_NAME:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1119 g_free(priv->name);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1120 priv->name = g_value_dup_string(value);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1121 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1122 case PROP_TYPE: {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1123 priv->type = g_value_get_flags(value);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1124 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1125 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1126 case PROP_CREATE_CB:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1127 priv->create = g_value_get_pointer(value);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1128 break;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 29210
diff changeset
1129 default:
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1130 G_OBJECT_WARN_INVALID_PROPERTY_ID(
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1131 object, prop_id, pspec);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1132 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1133 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1134 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1135
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1136 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1137 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
1138 GValue *value, GParamSpec *pspec)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1139 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1140 PurpleMediaElementInfoPrivate *priv;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1141 g_return_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(object));
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 29210
diff changeset
1142
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1143 priv = PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(object);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1144
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1145 switch (prop_id) {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1146 case PROP_ID:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1147 g_value_set_string(value, priv->id);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1148 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1149 case PROP_NAME:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1150 g_value_set_string(value, priv->name);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1151 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1152 case PROP_TYPE:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1153 g_value_set_flags(value, priv->type);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1154 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1155 case PROP_CREATE_CB:
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1156 g_value_set_pointer(value, priv->create);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1157 break;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 29210
diff changeset
1158 default:
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1159 G_OBJECT_WARN_INVALID_PROPERTY_ID(
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1160 object, prop_id, pspec);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1161 break;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1162 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1163 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1164
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1165 static void
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1166 purple_media_element_info_class_init(PurpleMediaElementInfoClass *klass)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1167 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1168 GObjectClass *gobject_class = (GObjectClass*)klass;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 29210
diff changeset
1169
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1170 gobject_class->finalize = purple_media_element_info_finalize;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1171 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
1172 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
1173
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1174 g_object_class_install_property(gobject_class, PROP_ID,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1175 g_param_spec_string("id",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1176 "ID",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1177 "The unique identifier of the element.",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1178 NULL,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1179 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1180
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1181 g_object_class_install_property(gobject_class, PROP_NAME,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1182 g_param_spec_string("name",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1183 "Name",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1184 "The friendly/display name of this element.",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1185 NULL,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1186 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1187
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1188 g_object_class_install_property(gobject_class, PROP_TYPE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1189 g_param_spec_flags("type",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1190 "Element Type",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1191 "The type of element this is.",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1192 PURPLE_TYPE_MEDIA_ELEMENT_TYPE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1193 PURPLE_MEDIA_ELEMENT_NONE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1194 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1195
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1196 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
1197 g_param_spec_pointer("create-cb",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1198 "Create Callback",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1199 "The function called to create this element.",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1200 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1201
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1202 g_type_class_add_private(klass, sizeof(PurpleMediaElementInfoPrivate));
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1203 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1204
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1205 G_DEFINE_TYPE(PurpleMediaElementInfo,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1206 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
1207 #else
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1208 GType
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1209 purple_media_element_info_get_type()
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1210 {
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1211 return G_TYPE_NONE;
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1212 }
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26412
diff changeset
1213 #endif
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1214
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1215 gchar *
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1216 purple_media_element_info_get_id(PurpleMediaElementInfo *info)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1217 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1218 #ifdef USE_VV
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1219 gchar *id;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1220 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
1221 g_object_get(info, "id", &id, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1222 return id;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1223 #else
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1224 return NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1225 #endif
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1226 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1227
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1228 gchar *
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1229 purple_media_element_info_get_name(PurpleMediaElementInfo *info)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1230 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1231 #ifdef USE_VV
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1232 gchar *name;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1233 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
1234 g_object_get(info, "name", &name, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1235 return name;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1236 #else
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1237 return NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1238 #endif
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1239 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1240
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1241 PurpleMediaElementType
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1242 purple_media_element_info_get_element_type(PurpleMediaElementInfo *info)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1243 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1244 #ifdef USE_VV
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1245 PurpleMediaElementType type;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1246 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
1247 PURPLE_MEDIA_ELEMENT_NONE);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1248 g_object_get(info, "type", &type, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1249 return type;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1250 #else
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1251 return PURPLE_MEDIA_ELEMENT_NONE;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1252 #endif
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1253 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1254
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1255 GstElement *
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1256 purple_media_element_info_call_create(PurpleMediaElementInfo *info,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1257 PurpleMedia *media, const gchar *session_id,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1258 const gchar *participant)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1259 {
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1260 #ifdef USE_VV
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1261 PurpleMediaElementCreateCallback create;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1262 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
1263 g_object_get(info, "create-cb", &create, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1264 if (create)
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1265 return create(media, session_id, participant);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1266 #endif
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1267 return NULL;
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1268 }
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26400
diff changeset
1269
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26526
diff changeset
1270 #endif /* USE_GSTREAMER */
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26526
diff changeset
1271