Thu, 14 Apr 2016 21:01:02 +0200
media: don't keep last sample reference on sinks
Holding a reference to a GstBuffer somewhere in a pipeline for possibly
indefinite period may cause trouble when the buffer has been allocated
by a 3rd party library or when it points directly into memory region of
a hardware device.
A specific example is V4L2 source element, which won't allow webcam
image resolution be reconfigured unless all previously allocated buffers
have been freed.
|
26105
7647c0dcf202
* Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
1 | /* purple |
| 19883 | 2 | * |
| 3 | * Purple is the legal property of its developers, whose names are too numerous | |
| 4 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 5 | * source distribution. | |
| 6 | * | |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
28321
c8d617c408ab
Update various header copyrights thanks to licensecheck.
Paul Aurich <darkrain42@pidgin.im>
parents:
28162
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 19883 | 20 | */ |
| 21 | ||
| 19889 | 22 | #include "internal.h" |
| 23 | ||
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26640
diff
changeset
|
24 | #include "account.h" |
|
26130
b5e9f243cf89
Gracefully handle missing the fsrtpconference GStreamer plugin.
Michael Ruprecht <maiku@pidgin.im>
parents:
26115
diff
changeset
|
25 | #include "debug.h" |
|
26479
47511dae9f81
Move GStreamer related media functions into its own header.
Michael Ruprecht <maiku@pidgin.im>
parents:
26427
diff
changeset
|
26 | #include "media.h" |
|
26760
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
27 | #include "mediamanager.h" |
|
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
28 | |
|
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
29 | #ifdef USE_GSTREAMER |
|
26792
17140fe8c2f6
Include the media API on win32 even though it isn't actually enabled.
Daniel Atallah <datallah@pidgin.im>
parents:
26760
diff
changeset
|
30 | #include "marshallers.h" |
|
26479
47511dae9f81
Move GStreamer related media functions into its own header.
Michael Ruprecht <maiku@pidgin.im>
parents:
26427
diff
changeset
|
31 | #include "media-gst.h" |
|
26760
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
32 | #endif |
| 19883 | 33 | |
|
23704
9b88c9b23aed
Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents:
23701
diff
changeset
|
34 | #ifdef USE_VV |
|
29620
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
35 | #include <media/backend-fs2.h> |
| 19883 | 36 | |
|
32113
2a75cce047d5
Port to Farstream
Olivier Crête <olivier.crete@collabora.com>
parents:
31565
diff
changeset
|
37 | #include <farstream/fs-element-added-notifier.h> |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
38 | #include <gst/video/videooverlay.h> |
|
36332
9b4a94c113b4
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36328
diff
changeset
|
39 | #ifdef HAVE_MEDIA_APPLICATION |
|
9b4a94c113b4
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36328
diff
changeset
|
40 | #include <gst/app/app.h> |
|
9b4a94c113b4
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36328
diff
changeset
|
41 | #endif |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
42 | |
|
26614
30eda41f2247
Hide the easy structs in mediamanager.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26522
diff
changeset
|
43 | /** @copydoc _PurpleMediaOutputWindow */ |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
44 | typedef struct _PurpleMediaOutputWindow PurpleMediaOutputWindow; |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
45 | /** @copydoc _PurpleMediaManagerPrivate */ |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
46 | typedef struct _PurpleMediaElementInfoPrivate PurpleMediaElementInfoPrivate; |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
47 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
48 | struct _PurpleMediaOutputWindow |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
49 | { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
50 | gulong id; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
51 | PurpleMedia *media; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
52 | gchar *session_id; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
53 | gchar *participant; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
54 | gulong window_id; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
55 | GstElement *sink; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
56 | }; |
| 19883 | 57 | |
| 58 | struct _PurpleMediaManagerPrivate | |
| 59 | { | |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
60 | GstElement *pipeline; |
|
26520
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
61 | PurpleMediaCaps ui_caps; |
| 19883 | 62 | GList *medias; |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
63 | GList *private_medias; |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
64 | GList *elements; |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
65 | GList *output_windows; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
66 | gulong next_output_window_id; |
|
29620
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
67 | GType backend_type; |
|
31311
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
68 | GstCaps *video_caps; |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
69 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
70 | PurpleMediaElementInfo *video_src; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
71 | PurpleMediaElementInfo *video_sink; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
72 | PurpleMediaElementInfo *audio_src; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
73 | PurpleMediaElementInfo *audio_sink; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
74 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
75 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
76 | /* Application data streams */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
77 | GList *appdata_info; /* holds PurpleMediaAppDataInfo */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
78 | GMutex appdata_mutex; |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
79 | guint appdata_cb_token; /* last used read/write callback token */ |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
80 | #endif |
| 19883 | 81 | }; |
| 82 | ||
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
83 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
84 | typedef struct { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
85 | PurpleMedia *media; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
86 | GWeakRef media_ref; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
87 | gchar *session_id; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
88 | gchar *participant; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
89 | PurpleMediaAppDataCallbacks callbacks; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
90 | gpointer user_data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
91 | GDestroyNotify notify; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
92 | GstAppSrc *appsrc; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
93 | GstAppSink *appsink; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
94 | gint num_samples; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
95 | GstSample *current_sample; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
96 | guint sample_offset; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
97 | gboolean writable; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
98 | gboolean connected; |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
99 | guint writable_cb_token; |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
100 | guint readable_cb_token; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
101 | guint writable_timer_id; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
102 | guint readable_timer_id; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
103 | GCond readable_cond; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
104 | } PurpleMediaAppDataInfo; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
105 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
106 | |
| 19883 | 107 | #define PURPLE_MEDIA_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerPrivate)) |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
108 | #define PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfoPrivate)) |
| 19883 | 109 | |
| 110 | static void purple_media_manager_class_init (PurpleMediaManagerClass *klass); | |
| 111 | static void purple_media_manager_init (PurpleMediaManager *media); | |
| 112 | static void purple_media_manager_finalize (GObject *object); | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
113 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
114 | static void free_appdata_info_locked (PurpleMediaAppDataInfo *info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
115 | #endif |
| 19883 | 116 | |
| 117 | static GObjectClass *parent_class = NULL; | |
| 118 | ||
| 119 | ||
| 120 | ||
| 121 | enum { | |
|
19885
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
122 | INIT_MEDIA, |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
123 | INIT_PRIVATE_MEDIA, |
|
29540
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
124 | UI_CAPS_CHANGED, |
| 19883 | 125 | LAST_SIGNAL |
| 126 | }; | |
| 127 | static guint purple_media_manager_signals[LAST_SIGNAL] = {0}; | |
|
26640
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
128 | #endif |
| 19883 | 129 | |
| 130 | GType | |
| 131 | purple_media_manager_get_type() | |
| 132 | { | |
|
26640
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
133 | #ifdef USE_VV |
| 19883 | 134 | static GType type = 0; |
| 135 | ||
| 136 | if (type == 0) { | |
| 137 | static const GTypeInfo info = { | |
| 138 | sizeof(PurpleMediaManagerClass), | |
| 139 | NULL, | |
| 140 | NULL, | |
| 141 | (GClassInitFunc) purple_media_manager_class_init, | |
| 142 | NULL, | |
| 143 | NULL, | |
| 144 | sizeof(PurpleMediaManager), | |
| 145 | 0, | |
|
22071
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19889
diff
changeset
|
146 | (GInstanceInitFunc) purple_media_manager_init, |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19889
diff
changeset
|
147 | NULL |
| 19883 | 148 | }; |
| 149 | type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0); | |
| 150 | } | |
| 151 | return type; | |
|
26640
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
152 | #else |
|
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
153 | return G_TYPE_NONE; |
|
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
154 | #endif |
| 19883 | 155 | } |
| 156 | ||
|
26640
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
157 | #ifdef USE_VV |
| 19883 | 158 | static void |
| 159 | purple_media_manager_class_init (PurpleMediaManagerClass *klass) | |
| 160 | { | |
| 161 | GObjectClass *gobject_class = (GObjectClass*)klass; | |
| 162 | parent_class = g_type_class_peek_parent(klass); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29620
diff
changeset
|
163 | |
| 19883 | 164 | gobject_class->finalize = purple_media_manager_finalize; |
| 165 | ||
|
19885
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
166 | purple_media_manager_signals[INIT_MEDIA] = g_signal_new ("init-media", |
| 19883 | 167 | G_TYPE_FROM_CLASS (klass), |
| 168 | G_SIGNAL_RUN_LAST, | |
| 169 | 0, NULL, NULL, | |
|
26183
d78798f480da
Remove connection attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26150
diff
changeset
|
170 | purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING, |
|
d78798f480da
Remove connection attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26150
diff
changeset
|
171 | G_TYPE_BOOLEAN, 3, PURPLE_TYPE_MEDIA, |
|
d78798f480da
Remove connection attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26150
diff
changeset
|
172 | G_TYPE_POINTER, G_TYPE_STRING); |
|
29540
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
173 | |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
174 | purple_media_manager_signals[INIT_PRIVATE_MEDIA] = |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
175 | g_signal_new ("init-private-media", |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
176 | G_TYPE_FROM_CLASS (klass), |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
177 | G_SIGNAL_RUN_LAST, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
178 | 0, NULL, NULL, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
179 | purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
180 | G_TYPE_BOOLEAN, 3, PURPLE_TYPE_MEDIA, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
181 | G_TYPE_POINTER, G_TYPE_STRING); |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
182 | |
|
29540
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
183 | purple_media_manager_signals[UI_CAPS_CHANGED] = g_signal_new ("ui-caps-changed", |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
184 | G_TYPE_FROM_CLASS (klass), |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
185 | G_SIGNAL_RUN_LAST, |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
186 | 0, NULL, NULL, |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
187 | purple_smarshal_VOID__FLAGS_FLAGS, |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
188 | G_TYPE_NONE, 2, PURPLE_MEDIA_TYPE_CAPS, |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
189 | PURPLE_MEDIA_TYPE_CAPS); |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
190 | |
| 19884 | 191 | g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate)); |
| 19883 | 192 | } |
| 193 | ||
| 194 | static void | |
| 195 | purple_media_manager_init (PurpleMediaManager *media) | |
| 196 | { | |
| 197 | media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); | |
| 19884 | 198 | media->priv->medias = NULL; |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
199 | media->priv->private_medias = NULL; |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
200 | media->priv->next_output_window_id = 1; |
|
29620
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
201 | media->priv->backend_type = PURPLE_TYPE_MEDIA_BACKEND_FS2; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
202 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
203 | media->priv->appdata_info = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
204 | g_mutex_init (&media->priv->appdata_mutex); |
|
29620
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
205 | #endif |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28110
diff
changeset
|
206 | |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28110
diff
changeset
|
207 | purple_prefs_add_none("/purple/media"); |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28110
diff
changeset
|
208 | purple_prefs_add_none("/purple/media/audio"); |
|
31557
02082aa1ba41
During a voice call, Pidgin now sends constant audio traffic, even when there
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31368
diff
changeset
|
209 | purple_prefs_add_int("/purple/media/audio/silence_threshold", 5); |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28110
diff
changeset
|
210 | purple_prefs_add_none("/purple/media/audio/volume"); |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28110
diff
changeset
|
211 | purple_prefs_add_int("/purple/media/audio/volume/input", 10); |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28110
diff
changeset
|
212 | purple_prefs_add_int("/purple/media/audio/volume/output", 10); |
| 19883 | 213 | } |
| 214 | ||
| 215 | static void | |
| 216 | purple_media_manager_finalize (GObject *media) | |
| 217 | { | |
|
26115
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
218 | PurpleMediaManagerPrivate *priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
219 | for (; priv->medias; priv->medias = |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
220 | g_list_delete_link(priv->medias, priv->medias)) { |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
221 | g_object_unref(priv->medias->data); |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
222 | } |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
223 | for (; priv->private_medias; priv->private_medias = |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
224 | g_list_delete_link(priv->private_medias, priv->private_medias)) { |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
225 | g_object_unref(priv->private_medias->data); |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
226 | } |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
227 | for (; priv->elements; priv->elements = |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
228 | g_list_delete_link(priv->elements, priv->elements)) { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
229 | g_object_unref(priv->elements->data); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
230 | } |
|
31311
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
231 | if (priv->video_caps) |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
232 | gst_caps_unref(priv->video_caps); |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
233 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
234 | if (priv->appdata_info) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
235 | g_list_free_full (priv->appdata_info, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
236 | (GDestroyNotify) free_appdata_info_locked); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
237 | g_mutex_clear (&priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
238 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
239 | |
| 19883 | 240 | parent_class->finalize(media); |
| 241 | } | |
|
26640
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
242 | #endif |
| 19883 | 243 | |
| 244 | PurpleMediaManager * | |
| 245 | purple_media_manager_get() | |
| 246 | { | |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
247 | #ifdef USE_VV |
| 19883 | 248 | static PurpleMediaManager *manager = NULL; |
| 249 | ||
| 250 | if (manager == NULL) | |
| 251 | manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL)); | |
| 252 | return manager; | |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
253 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
254 | return NULL; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
255 | #endif |
| 19883 | 256 | } |
| 257 | ||
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
258 | #ifdef USE_VV |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
259 | static gboolean |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
260 | pipeline_bus_call(GstBus *bus, GstMessage *msg, PurpleMediaManager *manager) |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
261 | { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
262 | switch(GST_MESSAGE_TYPE(msg)) { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
263 | case GST_MESSAGE_EOS: |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
264 | purple_debug_info("mediamanager", "End of Stream\n"); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
265 | break; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
266 | case GST_MESSAGE_ERROR: { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
267 | gchar *debug = NULL; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
268 | GError *err = NULL; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
269 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
270 | gst_message_parse_error(msg, &err, &debug); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
271 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
272 | purple_debug_error("mediamanager", |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
273 | "gst pipeline error: %s\n", |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
274 | err->message); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
275 | g_error_free(err); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
276 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
277 | if (debug) { |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
278 | purple_debug_error("mediamanager", |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
279 | "Debug details: %s\n", debug); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
280 | g_free (debug); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
281 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
282 | break; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
283 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
284 | default: |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
285 | break; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
286 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
287 | return TRUE; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
288 | } |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
289 | #endif |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
290 | |
|
26760
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
291 | #ifdef USE_GSTREAMER |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
292 | GstElement * |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
293 | purple_media_manager_get_pipeline(PurpleMediaManager *manager) |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
294 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
295 | #ifdef USE_VV |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
296 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
297 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
298 | if (manager->priv->pipeline == NULL) { |
|
28110
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
299 | FsElementAddedNotifier *notifier; |
|
28109
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
300 | gchar *filename; |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
301 | GError *err = NULL; |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
302 | GKeyFile *keyfile; |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
303 | GstBus *bus; |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
304 | manager->priv->pipeline = gst_pipeline_new(NULL); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
305 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
306 | bus = gst_pipeline_get_bus( |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
307 | GST_PIPELINE(manager->priv->pipeline)); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
308 | gst_bus_add_signal_watch(GST_BUS(bus)); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
309 | g_signal_connect(G_OBJECT(bus), "message", |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
310 | G_CALLBACK(pipeline_bus_call), manager); |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
311 | gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, NULL, NULL); |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
312 | gst_object_unref(bus); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
313 | |
|
28109
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
314 | filename = g_build_filename(purple_user_dir(), |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
315 | "fs-element.conf", NULL); |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
316 | keyfile = g_key_file_new(); |
|
28110
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
317 | if (!g_key_file_load_from_file(keyfile, filename, |
|
28109
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
318 | G_KEY_FILE_NONE, &err)) { |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
319 | if (err->code == 4) |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
320 | purple_debug_info("mediamanager", |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
321 | "Couldn't read " |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
322 | "fs-element.conf: %s\n", |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
323 | err->message); |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
324 | else |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
325 | purple_debug_error("mediamanager", |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
326 | "Error reading " |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
327 | "fs-element.conf: %s\n", |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
328 | err->message); |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
329 | g_error_free(err); |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
330 | } |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
331 | g_free(filename); |
|
0c7d09754f78
Allow setting properties on GStreamer elements with fs-element.conf.
Michael Ruprecht <maiku@pidgin.im>
parents:
27926
diff
changeset
|
332 | |
|
28110
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
333 | /* Hack to make alsasrc stop messing up audio timestamps */ |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
334 | if (!g_key_file_has_key(keyfile, |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
335 | "alsasrc", "slave-method", NULL)) { |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
336 | g_key_file_set_integer(keyfile, |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
337 | "alsasrc", "slave-method", 2); |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
338 | } |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
339 | |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
340 | notifier = fs_element_added_notifier_new(); |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
341 | fs_element_added_notifier_add(notifier, |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
342 | GST_BIN(manager->priv->pipeline)); |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
343 | fs_element_added_notifier_set_properties_from_keyfile( |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
344 | notifier, keyfile); |
|
f0fd4a9d7c5a
Set alsasrc's slave-method to 2. This stops the audio timestamps from
Michael Ruprecht <maiku@pidgin.im>
parents:
28109
diff
changeset
|
345 | |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
346 | gst_element_set_state(manager->priv->pipeline, |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
347 | GST_STATE_PLAYING); |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
348 | } |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
349 | |
|
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
350 | return manager->priv->pipeline; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
351 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
352 | return NULL; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
353 | #endif |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
354 | } |
|
26760
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
355 | #endif /* USE_GSTREAMER */ |
|
26320
2e9c1e8391f4
Move pipeline creation into the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
26315
diff
changeset
|
356 | |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
357 | static PurpleMedia * |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
358 | create_media(PurpleMediaManager *manager, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
359 | PurpleAccount *account, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
360 | const char *conference_type, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
361 | const char *remote_user, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
362 | gboolean initiator, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
363 | gboolean private) |
| 19883 | 364 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
365 | #ifdef USE_VV |
|
23701
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
366 | PurpleMedia *media; |
|
36330
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
367 | guint signal_id; |
|
23701
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
368 | |
|
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
369 | media = PURPLE_MEDIA(g_object_new(purple_media_get_type(), |
|
26315
c72d67da93eb
Use the media manager that created the media session in media.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
370 | "manager", manager, |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26640
diff
changeset
|
371 | "account", account, |
|
29565
c37ea1d82326
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
Michael Ruprecht <maiku@pidgin.im>
parents:
29540
diff
changeset
|
372 | "conference-type", conference_type, |
|
26187
3b3059a7c091
Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26185
diff
changeset
|
373 | "initiator", initiator, |
|
23701
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
374 | NULL)); |
|
26096
7249fdfc2eab
Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
375 | |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
376 | signal_id = private ? |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
377 | purple_media_manager_signals[INIT_PRIVATE_MEDIA] : |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
378 | purple_media_manager_signals[INIT_MEDIA]; |
|
36330
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
379 | |
|
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
380 | if (g_signal_has_handler_pending(manager, signal_id, 0, FALSE)) { |
|
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
381 | gboolean signal_ret; |
|
26111
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
382 | |
|
36330
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
383 | g_signal_emit(manager, signal_id, 0, media, account, remote_user, |
|
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
384 | &signal_ret); |
|
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
385 | if (signal_ret == FALSE) { |
|
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
386 | g_object_unref(media); |
|
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
387 | return NULL; |
|
7767aaeade64
media: make "init-media" signal handler optional
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36329
diff
changeset
|
388 | } |
|
26111
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
389 | } |
|
d25772351a75
Stop additional media sessions within a single conversation for grouped contacts.
Michael Ruprecht <maiku@pidgin.im>
parents:
26105
diff
changeset
|
390 | |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
391 | if (private) |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
392 | manager->priv->private_medias = g_list_append( |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
393 | manager->priv->private_medias, media); |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
394 | else |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
395 | manager->priv->medias = g_list_append(manager->priv->medias, media); |
| 19883 | 396 | return media; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
397 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
398 | return NULL; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
399 | #endif |
| 19883 | 400 | } |
| 401 | ||
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
402 | static GList * |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
403 | get_media(PurpleMediaManager *manager, gboolean private) |
|
26115
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
404 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
405 | #ifdef USE_VV |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
406 | if (private) |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
407 | return manager->priv->private_medias; |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
408 | else |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
409 | return manager->priv->medias; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
410 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
411 | return NULL; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
412 | #endif |
|
26115
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
413 | } |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
414 | |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
415 | static GList * |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
416 | get_media_by_account(PurpleMediaManager *manager, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
417 | PurpleAccount *account, gboolean private) |
|
26329
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
418 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
419 | #ifdef USE_VV |
|
26329
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
420 | GList *media = NULL; |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
421 | GList *iter; |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
422 | |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
423 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
424 | |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
425 | if (private) |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
426 | iter = manager->priv->private_medias; |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
427 | else |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
428 | iter = manager->priv->medias; |
|
26329
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
429 | for (; iter; iter = g_list_next(iter)) { |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26640
diff
changeset
|
430 | if (purple_media_get_account(iter->data) == account) { |
|
26329
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
431 | media = g_list_prepend(media, iter->data); |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
432 | } |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
433 | } |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
434 | |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
435 | return media; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
436 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
437 | return NULL; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
438 | #endif |
|
26329
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
439 | } |
|
6e390d9ea49a
Added purple_media_manager_get_media_by_connection.
Michael Ruprecht <maiku@pidgin.im>
parents:
26327
diff
changeset
|
440 | |
|
26115
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
441 | void |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
442 | purple_media_manager_remove_media(PurpleMediaManager *manager, PurpleMedia *media) |
|
26115
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
443 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
444 | #ifdef USE_VV |
|
35992
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32113
diff
changeset
|
445 | GList *list; |
|
37574
1786ba2950ce
Fix a uninitialized variable warning.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37421
diff
changeset
|
446 | GList **medias = NULL; |
|
35992
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32113
diff
changeset
|
447 | |
|
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32113
diff
changeset
|
448 | g_return_if_fail(manager != NULL); |
|
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32113
diff
changeset
|
449 | |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
450 | if ((list = g_list_find(manager->priv->medias, media))) { |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
451 | medias = &manager->priv->medias; |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
452 | } else if ((list = g_list_find(manager->priv->private_medias, media))) { |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
453 | medias = &manager->priv->private_medias; |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
454 | } |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
455 | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
456 | if (list) { |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
457 | *medias = g_list_delete_link(*medias, list); |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
458 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
459 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
460 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
461 | for (list = manager->priv->appdata_info; list; list = list->next) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
462 | PurpleMediaAppDataInfo *info = list->data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
463 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
464 | if (info->media == media) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
465 | manager->priv->appdata_info = g_list_delete_link ( |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
466 | manager->priv->appdata_info, list); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
467 | free_appdata_info_locked (info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
468 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
469 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
470 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
471 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
472 | } |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
473 | #endif |
|
26115
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
474 | } |
|
5f0500efc781
* Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents:
26111
diff
changeset
|
475 | |
|
36331
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
476 | PurpleMedia * |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
477 | purple_media_manager_create_media(PurpleMediaManager *manager, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
478 | PurpleAccount *account, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
479 | const char *conference_type, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
480 | const char *remote_user, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
481 | gboolean initiator) |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
482 | { |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
483 | return create_media (manager, account, conference_type, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
484 | remote_user, initiator, FALSE); |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
485 | } |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
486 | |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
487 | GList * |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
488 | purple_media_manager_get_media(PurpleMediaManager *manager) |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
489 | { |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
490 | return get_media (manager, FALSE); |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
491 | } |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
492 | |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
493 | GList * |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
494 | purple_media_manager_get_media_by_account(PurpleMediaManager *manager, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
495 | PurpleAccount *account) |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
496 | { |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
497 | return get_media_by_account (manager, account, FALSE); |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
498 | } |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
499 | |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
500 | PurpleMedia * |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
501 | purple_media_manager_create_private_media(PurpleMediaManager *manager, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
502 | PurpleAccount *account, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
503 | const char *conference_type, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
504 | const char *remote_user, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
505 | gboolean initiator) |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
506 | { |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
507 | return create_media (manager, account, conference_type, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
508 | remote_user, initiator, TRUE); |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
509 | } |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
510 | |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
511 | GList * |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
512 | purple_media_manager_get_private_media(PurpleMediaManager *manager) |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
513 | { |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
514 | return get_media (manager, TRUE); |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
515 | } |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
516 | |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
517 | GList * |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
518 | purple_media_manager_get_private_media_by_account(PurpleMediaManager *manager, |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
519 | PurpleAccount *account) |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
520 | { |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
521 | return get_media_by_account (manager, account, TRUE); |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
522 | } |
|
d729a9b21265
Add Private media API
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36330
diff
changeset
|
523 | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
524 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
525 | static void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
526 | free_appdata_info_locked (PurpleMediaAppDataInfo *info) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
527 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
528 | if (info->notify) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
529 | info->notify (info->user_data); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
530 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
531 | /* Make sure no other thread is using the structure */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
532 | g_free (info->session_id); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
533 | g_free (info->participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
534 | |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
535 | /* This lets the potential read or write callbacks waiting for appdata_mutex |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
536 | * know the info structure has been destroyed. */ |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
537 | info->readable_cb_token = 0; |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
538 | info->writable_cb_token = 0; |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
539 | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
540 | if (info->readable_timer_id) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
541 | purple_timeout_remove (info->readable_timer_id); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
542 | info->readable_timer_id = 0; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
543 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
544 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
545 | if (info->writable_timer_id) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
546 | purple_timeout_remove (info->writable_timer_id); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
547 | info->writable_timer_id = 0; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
548 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
549 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
550 | if (info->current_sample) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
551 | gst_sample_unref (info->current_sample); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
552 | info->current_sample = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
553 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
554 | /* Unblock any reading thread before destroying the GCond */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
555 | g_cond_broadcast (&info->readable_cond); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
556 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
557 | g_cond_clear (&info->readable_cond); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
558 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
559 | g_slice_free (PurpleMediaAppDataInfo, info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
560 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
561 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
562 | /* |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
563 | * Get an app data info struct associated with a session and lock the mutex |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
564 | * We don't want to return an info struct and unlock then it gets destroyed |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
565 | * so we need to return it with the lock still taken |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
566 | */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
567 | static PurpleMediaAppDataInfo * |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
568 | get_app_data_info_and_lock (PurpleMediaManager *manager, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
569 | PurpleMedia *media, const gchar *session_id, const gchar *participant) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
570 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
571 | GList *i; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
572 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
573 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
574 | for (i = manager->priv->appdata_info; i; i = i->next) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
575 | PurpleMediaAppDataInfo *info = i->data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
576 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
577 | if (info->media == media && |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
578 | g_strcmp0 (info->session_id, session_id) == 0 && |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
579 | (participant == NULL || |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
580 | g_strcmp0 (info->participant, participant) == 0)) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
581 | return info; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
582 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
583 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
584 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
585 | return NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
586 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
587 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
588 | /* |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
589 | * Get an app data info struct associated with a session and lock the mutex |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
590 | * if it doesn't exist, we create it. |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
591 | */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
592 | static PurpleMediaAppDataInfo * |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
593 | ensure_app_data_info_and_lock (PurpleMediaManager *manager, PurpleMedia *media, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
594 | const gchar *session_id, const gchar *participant) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
595 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
596 | PurpleMediaAppDataInfo * info = get_app_data_info_and_lock (manager, media, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
597 | session_id, participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
598 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
599 | if (info == NULL) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
600 | info = g_slice_new0 (PurpleMediaAppDataInfo); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
601 | info->media = media; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
602 | g_weak_ref_init (&info->media_ref, media); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
603 | info->session_id = g_strdup (session_id); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
604 | info->participant = g_strdup (participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
605 | g_cond_init (&info->readable_cond); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
606 | manager->priv->appdata_info = g_list_prepend ( |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
607 | manager->priv->appdata_info, info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
608 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
609 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
610 | return info; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
611 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
612 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
613 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
614 | |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
615 | #ifdef USE_VV |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
616 | static void |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
617 | request_pad_unlinked_cb(GstPad *pad, GstPad *peer, gpointer user_data) |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
618 | { |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
619 | GstElement *parent = GST_ELEMENT_PARENT(pad); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
620 | GstIterator *iter; |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
621 | GValue tmp = G_VALUE_INIT; |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
622 | GstPad *remaining_pad; |
|
28132
5565fd8df570
Unleak pad if more pads are linked.
Michael Ruprecht <maiku@pidgin.im>
parents:
28125
diff
changeset
|
623 | GstIteratorResult result; |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
624 | |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
625 | gst_element_release_request_pad(parent, pad); |
|
31313
eca4138f416c
This patch fixes #12758.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31311
diff
changeset
|
626 | |
|
28132
5565fd8df570
Unleak pad if more pads are linked.
Michael Ruprecht <maiku@pidgin.im>
parents:
28125
diff
changeset
|
627 | iter = gst_element_iterate_src_pads(parent); |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
628 | |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
629 | result = gst_iterator_next(iter, &tmp); |
|
28132
5565fd8df570
Unleak pad if more pads are linked.
Michael Ruprecht <maiku@pidgin.im>
parents:
28125
diff
changeset
|
630 | |
|
5565fd8df570
Unleak pad if more pads are linked.
Michael Ruprecht <maiku@pidgin.im>
parents:
28125
diff
changeset
|
631 | if (result == GST_ITERATOR_DONE) { |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
632 | gst_element_set_locked_state(parent, TRUE); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
633 | gst_element_set_state(parent, GST_STATE_NULL); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
634 | gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(parent)), parent); |
|
28132
5565fd8df570
Unleak pad if more pads are linked.
Michael Ruprecht <maiku@pidgin.im>
parents:
28125
diff
changeset
|
635 | } else if (result == GST_ITERATOR_OK) { |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
636 | remaining_pad = g_value_get_object(&tmp); |
|
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
637 | g_value_reset(&tmp); |
|
28132
5565fd8df570
Unleak pad if more pads are linked.
Michael Ruprecht <maiku@pidgin.im>
parents:
28125
diff
changeset
|
638 | gst_object_unref(remaining_pad); |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
639 | } |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
640 | |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
641 | gst_iterator_free(iter); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
642 | } |
|
36329
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
643 | |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
644 | static void |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
645 | nonunique_src_unlinked_cb(GstPad *pad, GstPad *peer, gpointer user_data) |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
646 | { |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
647 | GstElement *element = GST_ELEMENT_PARENT(pad); |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
648 | gst_element_set_locked_state(element, TRUE); |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
649 | gst_element_set_state(element, GST_STATE_NULL); |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
650 | gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(element)), element); |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
651 | } |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
652 | |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
653 | #endif |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
654 | |
|
26760
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
655 | #ifdef USE_GSTREAMER |
|
31311
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
656 | |
|
31319
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
657 | void |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
658 | purple_media_manager_set_video_caps(PurpleMediaManager *manager, GstCaps *caps) |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
659 | { |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
660 | #ifdef USE_VV |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
661 | if (manager->priv->video_caps) |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
662 | gst_caps_unref(manager->priv->video_caps); |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
663 | |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
664 | manager->priv->video_caps = caps; |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
665 | |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
666 | if (manager->priv->pipeline && manager->priv->video_src) { |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
667 | gchar *id = purple_media_element_info_get_id(manager->priv->video_src); |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
668 | GstElement *src = gst_bin_get_by_name(GST_BIN(manager->priv->pipeline), id); |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
669 | |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
670 | if (src) { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
33948
diff
changeset
|
671 | GstElement *capsfilter = gst_bin_get_by_name(GST_BIN(src), "protocol_video_caps"); |
|
36280
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
672 | if (capsfilter) { |
|
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
673 | g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL); |
|
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
674 | gst_object_unref (capsfilter); |
|
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
675 | } |
|
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
676 | gst_object_unref (src); |
|
31319
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
677 | } |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
678 | |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
679 | g_free(id); |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
680 | } |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
681 | #endif |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
682 | } |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
683 | |
|
b271e590aaf9
Public API allowing plugins (including prpls) to get/set video capabilities where desired/appropriate. Fixes #13095.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31313
diff
changeset
|
684 | GstCaps * |
|
31311
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
685 | purple_media_manager_get_video_caps(PurpleMediaManager *manager) |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
686 | { |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
687 | #ifdef USE_VV |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
688 | if (manager->priv->video_caps == NULL) |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
689 | manager->priv->video_caps = gst_caps_from_string("video/x-raw," |
|
31311
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
690 | "width=[250,352], height=[200,288], framerate=[1/1,20/1]"); |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
691 | return manager->priv->video_caps; |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
692 | #else |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
693 | return NULL; |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
694 | #endif |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
695 | } |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
696 | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
697 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
698 | /* |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
699 | * Calls the appdata writable callback from the main thread. |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
700 | * This needs to grab the appdata lock and make sure it didn't get destroyed |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
701 | * before calling the callback. |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
702 | */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
703 | static gboolean |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
704 | appsrc_writable (gpointer user_data) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
705 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
706 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
707 | PurpleMediaAppDataInfo *info = user_data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
708 | void (*writable_cb) (PurpleMediaManager *manager, PurpleMedia *media, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
709 | const gchar *session_id, const gchar *participant, gboolean writable, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
710 | gpointer user_data); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
711 | PurpleMedia *media; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
712 | gchar *session_id; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
713 | gchar *participant; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
714 | gboolean writable; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
715 | gpointer cb_data; |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
716 | guint *cb_token_ptr = &info->writable_cb_token; |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
717 | guint cb_token = *cb_token_ptr; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
718 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
719 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
720 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
721 | if (cb_token == 0 || cb_token != *cb_token_ptr) { |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
722 | /* In case info was freed while we were waiting for the mutex to unlock |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
723 | * we still have a pointer to the cb_token which should still be |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
724 | * accessible since it's in the Glib slice allocator. It gets set to 0 |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
725 | * just after the timeout is canceled which happens also before the |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
726 | * AppDataInfo is freed, so even if that memory slice gets reused, the |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
727 | * cb_token would be different from its previous value (unless |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
728 | * extremely unlucky). So checking if the value for the cb_token changed |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
729 | * should be enough to prevent any kind of race condition in which the |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
730 | * media/AppDataInfo gets destroyed in one thread while the timeout was |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
731 | * triggered and is waiting on the mutex to get unlocked in this thread |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
732 | */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
733 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
734 | return FALSE; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
735 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
736 | writable_cb = info->callbacks.writable; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
737 | media = g_weak_ref_get (&info->media_ref); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
738 | session_id = g_strdup (info->session_id); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
739 | participant = g_strdup (info->participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
740 | writable = info->writable && info->connected; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
741 | cb_data = info->user_data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
742 | |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
743 | info->writable_cb_token = 0; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
744 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
745 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
746 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
747 | if (writable_cb && media) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
748 | writable_cb (manager, media, session_id, participant, writable, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
749 | cb_data); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
750 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
751 | g_object_unref (media); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
752 | g_free (session_id); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
753 | g_free (participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
754 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
755 | return FALSE; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
756 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
757 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
758 | /* |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
759 | * Schedule a writable callback to be called from the main thread. |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
760 | * We need to do this because need-data/enough-data signals from appsrc |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
761 | * will come from the streaming thread and we need to create |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
762 | * a source that we attach to the main context but we can't use |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
763 | * g_main_context_invoke since we need to be able to cancel the source if the |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
764 | * media gets destroyed. |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
765 | * We use a timeout source instead of idle source, so the callback gets a higher |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
766 | * priority |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
767 | */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
768 | static void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
769 | call_appsrc_writable_locked (PurpleMediaAppDataInfo *info) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
770 | { |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
771 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
772 | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
773 | /* We already have a writable callback scheduled, don't create another one */ |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
774 | if (info->writable_cb_token || info->callbacks.writable == NULL) |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
775 | return; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
776 | |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
777 | /* We can't use writable_timer_id as a token, because the timeout is added |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
778 | * into libpurple's main event loop, which runs in a different thread than |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
779 | * from where call_appsrc_writable_locked() was called. Consequently, the |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
780 | * callback may run even before purple_timeout_add() returns the timer ID |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
781 | * to us. */ |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
782 | info->writable_cb_token = ++manager->priv->appdata_cb_token; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
783 | info->writable_timer_id = purple_timeout_add (0, appsrc_writable, info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
784 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
785 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
786 | static void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
787 | appsrc_need_data (GstAppSrc *appsrc, guint length, gpointer user_data) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
788 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
789 | PurpleMediaAppDataInfo *info = user_data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
790 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
791 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
792 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
793 | if (!info->writable) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
794 | info->writable = TRUE; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
795 | /* Only signal writable if we also established a connection */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
796 | if (info->connected) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
797 | call_appsrc_writable_locked (info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
798 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
799 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
800 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
801 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
802 | static void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
803 | appsrc_enough_data (GstAppSrc *appsrc, gpointer user_data) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
804 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
805 | PurpleMediaAppDataInfo *info = user_data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
806 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
807 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
808 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
809 | if (info->writable) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
810 | info->writable = FALSE; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
811 | call_appsrc_writable_locked (info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
812 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
813 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
814 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
815 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
816 | static gboolean |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
817 | appsrc_seek_data (GstAppSrc *appsrc, guint64 offset, gpointer user_data) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
818 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
819 | return FALSE; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
820 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
821 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
822 | static void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
823 | appsrc_destroyed (PurpleMediaAppDataInfo *info) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
824 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
825 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
826 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
827 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
828 | info->appsrc = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
829 | if (info->writable) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
830 | info->writable = FALSE; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
831 | call_appsrc_writable_locked (info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
832 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
833 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
834 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
835 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
836 | static void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
837 | media_established_cb (PurpleMedia *media,const gchar *session_id, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
838 | const gchar *participant, PurpleMediaCandidate *local_candidate, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
839 | PurpleMediaCandidate *remote_candidate, PurpleMediaAppDataInfo *info) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
840 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
841 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
842 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
843 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
844 | info->connected = TRUE; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
845 | /* We established the connection, if we were writable, then we need to |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
846 | * signal it now */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
847 | if (info->writable) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
848 | call_appsrc_writable_locked (info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
849 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
850 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
851 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
852 | static GstElement * |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
853 | create_send_appsrc(PurpleMedia *media, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
854 | const gchar *session_id, const gchar *participant) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
855 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
856 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
857 | PurpleMediaAppDataInfo * info = ensure_app_data_info_and_lock (manager, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
858 | media, session_id, participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
859 | GstElement *appsrc = (GstElement *)info->appsrc; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
860 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
861 | if (appsrc == NULL) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
862 | GstAppSrcCallbacks callbacks = {appsrc_need_data, appsrc_enough_data, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
863 | appsrc_seek_data, {NULL}}; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
864 | GstCaps *caps = gst_caps_new_empty_simple ("application/octet-stream"); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
865 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
866 | appsrc = gst_element_factory_make("appsrc", NULL); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
867 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
868 | info->appsrc = (GstAppSrc *)appsrc; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
869 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
870 | gst_app_src_set_caps (info->appsrc, caps); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
871 | gst_app_src_set_callbacks (info->appsrc, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
872 | &callbacks, info, (GDestroyNotify) appsrc_destroyed); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
873 | g_signal_connect (media, "candidate-pair-established", |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
874 | (GCallback) media_established_cb, info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
875 | gst_caps_unref (caps); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
876 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
877 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
878 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
879 | return appsrc; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
880 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
881 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
882 | static void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
883 | appsink_eos (GstAppSink *appsink, gpointer user_data) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
884 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
885 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
886 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
887 | static GstFlowReturn |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
888 | appsink_new_preroll (GstAppSink *appsink, gpointer user_data) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
889 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
890 | return GST_FLOW_OK; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
891 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
892 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
893 | static gboolean |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
894 | appsink_readable (gpointer user_data) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
895 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
896 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
897 | PurpleMediaAppDataInfo *info = user_data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
898 | void (*readable_cb) (PurpleMediaManager *manager, PurpleMedia *media, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
899 | const gchar *session_id, const gchar *participant, gpointer user_data); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
900 | PurpleMedia *media; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
901 | gchar *session_id; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
902 | gchar *participant; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
903 | gpointer cb_data; |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
904 | guint *cb_token_ptr = &info->readable_cb_token; |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
905 | guint cb_token = *cb_token_ptr; |
|
37244
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
906 | gboolean run_again = FALSE; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
907 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
908 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
909 | if (cb_token == 0 || cb_token != *cb_token_ptr) { |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
910 | /* Avoided a race condition (see writable callback) */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
911 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
912 | return FALSE; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
913 | } |
|
37244
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
914 | |
|
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
915 | if (info->callbacks.readable && |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
916 | (info->num_samples > 0 || info->current_sample != NULL)) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
917 | readable_cb = info->callbacks.readable; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
918 | media = g_weak_ref_get (&info->media_ref); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
919 | session_id = g_strdup (info->session_id); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
920 | participant = g_strdup (info->participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
921 | cb_data = info->user_data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
922 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
923 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
924 | if (readable_cb) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
925 | readable_cb (manager, media, session_id, participant, cb_data); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
926 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
927 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
928 | g_object_unref (media); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
929 | g_free (session_id); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
930 | g_free (participant); |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
931 | if (cb_token == 0 || cb_token != *cb_token_ptr) { |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
932 | /* We got cancelled */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
933 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
934 | return FALSE; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
935 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
936 | } |
|
37244
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
937 | |
|
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
938 | /* Do we still have samples? Schedule appsink_readable again. We break here |
|
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
939 | * so that other events get a chance to be processed too. */ |
|
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
940 | if (info->num_samples > 0 || info->current_sample != NULL) { |
|
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
941 | run_again = TRUE; |
|
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
942 | } else { |
|
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
943 | info->readable_cb_token = 0; |
|
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
944 | } |
|
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
945 | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
946 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
37244
cbc4db14444c
Don't require appsink be drained in appsink_readable
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37236
diff
changeset
|
947 | return run_again; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
948 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
949 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
950 | static void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
951 | call_appsink_readable_locked (PurpleMediaAppDataInfo *info) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
952 | { |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
953 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
954 | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
955 | /* We must signal that a new sample has arrived to release blocking reads */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
956 | g_cond_broadcast (&info->readable_cond); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
957 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
958 | /* We already have a writable callback scheduled, don't create another one */ |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
959 | if (info->readable_cb_token || info->callbacks.readable == NULL) |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
960 | return; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
961 | |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
962 | info->readable_cb_token = ++manager->priv->appdata_cb_token; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
963 | info->readable_timer_id = purple_timeout_add (0, appsink_readable, info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
964 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
965 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
966 | static GstFlowReturn |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
967 | appsink_new_sample (GstAppSink *appsink, gpointer user_data) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
968 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
969 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
970 | PurpleMediaAppDataInfo *info = user_data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
971 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
972 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
973 | info->num_samples++; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
974 | call_appsink_readable_locked (info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
975 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
976 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
977 | return GST_FLOW_OK; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
978 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
979 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
980 | static void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
981 | appsink_destroyed (PurpleMediaAppDataInfo *info) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
982 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
983 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
984 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
985 | g_mutex_lock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
986 | info->appsink = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
987 | info->num_samples = 0; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
988 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
989 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
990 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
991 | static GstElement * |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
992 | create_recv_appsink(PurpleMedia *media, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
993 | const gchar *session_id, const gchar *participant) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
994 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
995 | PurpleMediaManager *manager = purple_media_manager_get (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
996 | PurpleMediaAppDataInfo * info = ensure_app_data_info_and_lock (manager, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
997 | media, session_id, participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
998 | GstElement *appsink = (GstElement *)info->appsink; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
999 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1000 | if (appsink == NULL) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1001 | GstAppSinkCallbacks callbacks = {appsink_eos, appsink_new_preroll, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1002 | appsink_new_sample, {NULL}}; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1003 | GstCaps *caps = gst_caps_new_empty_simple ("application/octet-stream"); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1004 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1005 | appsink = gst_element_factory_make("appsink", NULL); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1006 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1007 | info->appsink = (GstAppSink *)appsink; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1008 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1009 | gst_app_sink_set_caps (info->appsink, caps); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1010 | gst_app_sink_set_callbacks (info->appsink, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1011 | &callbacks, info, (GDestroyNotify) appsink_destroyed); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1012 | gst_caps_unref (caps); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1013 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1014 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1015 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1016 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1017 | return appsink; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1018 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1019 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1020 | |
|
37226
30f166f60ee0
wrap two VV-specific functions in #ifdef USE_VV
Michael McConville <mmcconville@mykolab.com>
parents:
37217
diff
changeset
|
1021 | #ifdef USE_VV |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1022 | static PurpleMediaElementInfo * |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1023 | get_send_application_element_info () |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1024 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1025 | static PurpleMediaElementInfo *info = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1026 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1027 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1028 | if (info == NULL) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1029 | info = g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1030 | "id", "pidginappsrc", |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1031 | "name", "Pidgin Application Source", |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1032 | "type", PURPLE_MEDIA_ELEMENT_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1033 | | PURPLE_MEDIA_ELEMENT_SRC |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1034 | | PURPLE_MEDIA_ELEMENT_ONE_SRC, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1035 | "create-cb", create_send_appsrc, NULL); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1036 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1037 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1038 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1039 | return info; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1040 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1041 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1042 | static PurpleMediaElementInfo * |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1043 | get_recv_application_element_info () |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1044 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1045 | static PurpleMediaElementInfo *info = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1046 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1047 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1048 | if (info == NULL) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1049 | info = g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1050 | "id", "pidginappsink", |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1051 | "name", "Pidgin Application Sink", |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1052 | "type", PURPLE_MEDIA_ELEMENT_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1053 | | PURPLE_MEDIA_ELEMENT_SINK |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1054 | | PURPLE_MEDIA_ELEMENT_ONE_SINK, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1055 | "create-cb", create_recv_appsink, NULL); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1056 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1057 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1058 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1059 | return info; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1060 | } |
|
37226
30f166f60ee0
wrap two VV-specific functions in #ifdef USE_VV
Michael McConville <mmcconville@mykolab.com>
parents:
37217
diff
changeset
|
1061 | #endif /* USE_VV */ |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1062 | |
|
26150
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1063 | GstElement * |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1064 | purple_media_manager_get_element(PurpleMediaManager *manager, |
|
26522
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26520
diff
changeset
|
1065 | PurpleMediaSessionType type, PurpleMedia *media, |
|
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26520
diff
changeset
|
1066 | const gchar *session_id, const gchar *participant) |
|
26150
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1067 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1068 | #ifdef USE_VV |
|
26150
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1069 | GstElement *ret = NULL; |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1070 | PurpleMediaElementInfo *info = NULL; |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1071 | PurpleMediaElementType element_type; |
|
26150
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1072 | |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1073 | if (type & PURPLE_MEDIA_SEND_AUDIO) |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1074 | info = manager->priv->audio_src; |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1075 | else if (type & PURPLE_MEDIA_RECV_AUDIO) |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1076 | info = manager->priv->audio_sink; |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1077 | else if (type & PURPLE_MEDIA_SEND_VIDEO) |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1078 | info = manager->priv->video_src; |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1079 | else if (type & PURPLE_MEDIA_RECV_VIDEO) |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1080 | info = manager->priv->video_sink; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1081 | else if (type & PURPLE_MEDIA_SEND_APPLICATION) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1082 | info = get_send_application_element_info (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1083 | else if (type & PURPLE_MEDIA_RECV_APPLICATION) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1084 | info = get_recv_application_element_info (); |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1085 | |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1086 | if (info == NULL) |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1087 | return NULL; |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1088 | |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1089 | element_type = purple_media_element_info_get_element_type(info); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1090 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1091 | if (element_type & PURPLE_MEDIA_ELEMENT_UNIQUE && |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1092 | element_type & PURPLE_MEDIA_ELEMENT_SRC) { |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1093 | GstElement *tee; |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1094 | GstPad *pad; |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1095 | GstPad *ghost; |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1096 | gchar *id = purple_media_element_info_get_id(info); |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1097 | |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1098 | ret = gst_bin_get_by_name(GST_BIN( |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1099 | purple_media_manager_get_pipeline( |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1100 | manager)), id); |
|
26150
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1101 | |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1102 | if (ret == NULL) { |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1103 | GstElement *bin, *fakesink; |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1104 | ret = purple_media_element_info_call_create(info, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1105 | media, session_id, participant); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1106 | bin = gst_bin_new(id); |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1107 | tee = gst_element_factory_make("tee", "tee"); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1108 | gst_bin_add_many(GST_BIN(bin), ret, tee, NULL); |
|
31311
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1109 | |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1110 | if (type & PURPLE_MEDIA_SEND_VIDEO) { |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1111 | GstElement *videoscale; |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1112 | GstElement *capsfilter; |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1113 | |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1114 | videoscale = gst_element_factory_make("videoscale", NULL); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
33948
diff
changeset
|
1115 | capsfilter = gst_element_factory_make("capsfilter", "protocol_video_caps"); |
|
31311
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1116 | |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1117 | g_object_set(G_OBJECT(capsfilter), |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1118 | "caps", purple_media_manager_get_video_caps(manager), NULL); |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1119 | |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1120 | gst_bin_add_many(GST_BIN(bin), videoscale, capsfilter, NULL); |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1121 | gst_element_link_many(ret, videoscale, capsfilter, tee, NULL); |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1122 | } else |
|
740a84050c72
Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31294
diff
changeset
|
1123 | gst_element_link(ret, tee); |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1124 | |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1125 | /* |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1126 | * This shouldn't be necessary, but it stops it from |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1127 | * giving a not-linked error upon destruction |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1128 | */ |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1129 | fakesink = gst_element_factory_make("fakesink", NULL); |
|
37648
13807c514810
media: don't keep last sample reference on sinks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37574
diff
changeset
|
1130 | g_object_set(fakesink, |
|
13807c514810
media: don't keep last sample reference on sinks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37574
diff
changeset
|
1131 | "sync", FALSE, |
|
13807c514810
media: don't keep last sample reference on sinks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37574
diff
changeset
|
1132 | "enable-last-sample", FALSE, |
|
13807c514810
media: don't keep last sample reference on sinks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37574
diff
changeset
|
1133 | NULL); |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1134 | gst_bin_add(GST_BIN(bin), fakesink); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1135 | gst_element_link(tee, fakesink); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1136 | |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1137 | ret = bin; |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1138 | gst_object_ref(ret); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1139 | gst_bin_add(GST_BIN(purple_media_manager_get_pipeline( |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1140 | manager)), ret); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1141 | } |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1142 | g_free(id); |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1143 | |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1144 | tee = gst_bin_get_by_name(GST_BIN(ret), "tee"); |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1145 | pad = gst_element_get_request_pad(tee, "src_%u"); |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1146 | gst_object_unref(tee); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1147 | ghost = gst_ghost_pad_new(NULL, pad); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1148 | gst_object_unref(pad); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1149 | g_signal_connect(GST_PAD(ghost), "unlinked", |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1150 | G_CALLBACK(request_pad_unlinked_cb), NULL); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1151 | gst_pad_set_active(ghost, TRUE); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1152 | gst_element_add_pad(ret, ghost); |
|
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1153 | } else { |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1154 | ret = purple_media_element_info_call_create(info, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1155 | media, session_id, participant); |
|
36280
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
1156 | if (element_type & PURPLE_MEDIA_ELEMENT_SRC) { |
|
36329
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
1157 | GstPad *pad = gst_element_get_static_pad(ret, "src"); |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
1158 | g_signal_connect(pad, "unlinked", |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
1159 | G_CALLBACK(nonunique_src_unlinked_cb), NULL); |
|
8e4fa54f1662
media: ensure nonunique source is removed from pipeline when unlinked
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36316
diff
changeset
|
1160 | gst_object_unref(pad); |
|
36280
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
1161 | gst_object_ref(ret); |
|
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
1162 | gst_bin_add(GST_BIN(purple_media_manager_get_pipeline(manager)), |
|
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
1163 | ret); |
|
b52be4fef1de
Fix gstreamer elements references
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
35992
diff
changeset
|
1164 | } |
|
26511
764632d560ee
Make sharing sources between media sessions work.
Michael Ruprecht <maiku@pidgin.im>
parents:
26480
diff
changeset
|
1165 | } |
|
26150
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1166 | |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1167 | if (ret == NULL) |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1168 | purple_debug_error("media", "Error creating source or sink\n"); |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1169 | |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1170 | return ret; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1171 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1172 | return NULL; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1173 | #endif |
|
26150
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1174 | } |
|
951503fc5456
Add purple_media_manager_get_element.
Michael Ruprecht <maiku@pidgin.im>
parents:
26130
diff
changeset
|
1175 | |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1176 | PurpleMediaElementInfo * |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1177 | purple_media_manager_get_element_info(PurpleMediaManager *manager, |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1178 | const gchar *id) |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1179 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1180 | #ifdef USE_VV |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1181 | GList *iter; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1182 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1183 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1184 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1185 | iter = manager->priv->elements; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1186 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1187 | for (; iter; iter = g_list_next(iter)) { |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1188 | gchar *element_id = |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1189 | purple_media_element_info_get_id(iter->data); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1190 | if (!strcmp(element_id, id)) { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1191 | g_free(element_id); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1192 | g_object_ref(iter->data); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1193 | return iter->data; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1194 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1195 | g_free(element_id); |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1196 | } |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1197 | #endif |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1198 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1199 | return NULL; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1200 | } |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1201 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1202 | gboolean |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1203 | purple_media_manager_register_element(PurpleMediaManager *manager, |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1204 | PurpleMediaElementInfo *info) |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1205 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1206 | #ifdef USE_VV |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1207 | PurpleMediaElementInfo *info2; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1208 | gchar *id; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1209 | |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1210 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1211 | g_return_val_if_fail(info != NULL, FALSE); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1212 | |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1213 | id = purple_media_element_info_get_id(info); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1214 | info2 = purple_media_manager_get_element_info(manager, id); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1215 | g_free(id); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1216 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1217 | if (info2 != NULL) { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1218 | g_object_unref(info2); |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1219 | return FALSE; |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1220 | } |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1221 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1222 | manager->priv->elements = |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1223 | g_list_prepend(manager->priv->elements, info); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1224 | return TRUE; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1225 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1226 | return FALSE; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1227 | #endif |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1228 | } |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1229 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1230 | gboolean |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1231 | purple_media_manager_unregister_element(PurpleMediaManager *manager, |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1232 | const gchar *id) |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1233 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1234 | #ifdef USE_VV |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1235 | PurpleMediaElementInfo *info; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1236 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1237 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1238 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1239 | info = purple_media_manager_get_element_info(manager, id); |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1240 | |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1241 | if (info == NULL) { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1242 | g_object_unref(info); |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1243 | return FALSE; |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1244 | } |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1245 | |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1246 | if (manager->priv->audio_src == info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1247 | manager->priv->audio_src = NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1248 | if (manager->priv->audio_sink == info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1249 | manager->priv->audio_sink = NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1250 | if (manager->priv->video_src == info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1251 | manager->priv->video_src = NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1252 | if (manager->priv->video_sink == info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1253 | manager->priv->video_sink = NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1254 | |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1255 | manager->priv->elements = g_list_remove( |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1256 | manager->priv->elements, info); |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1257 | g_object_unref(info); |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1258 | return TRUE; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1259 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1260 | return FALSE; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1261 | #endif |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1262 | } |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
1263 | |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1264 | gboolean |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1265 | purple_media_manager_set_active_element(PurpleMediaManager *manager, |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1266 | PurpleMediaElementInfo *info) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1267 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1268 | #ifdef USE_VV |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1269 | PurpleMediaElementInfo *info2; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1270 | PurpleMediaElementType type; |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1271 | gboolean ret = FALSE; |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1272 | gchar *id; |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1273 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1274 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1275 | g_return_val_if_fail(info != NULL, FALSE); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1276 | |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1277 | id = purple_media_element_info_get_id(info); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1278 | info2 = purple_media_manager_get_element_info(manager, id); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1279 | g_free(id); |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1280 | |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1281 | if (info2 == NULL) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1282 | purple_media_manager_register_element(manager, info); |
| 26748 | 1283 | else |
| 1284 | g_object_unref(info2); | |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1285 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1286 | type = purple_media_element_info_get_element_type(info); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1287 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1288 | if (type & PURPLE_MEDIA_ELEMENT_SRC) { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1289 | if (type & PURPLE_MEDIA_ELEMENT_AUDIO) { |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1290 | manager->priv->audio_src = info; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1291 | ret = TRUE; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1292 | } |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1293 | if (type & PURPLE_MEDIA_ELEMENT_VIDEO) { |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1294 | manager->priv->video_src = info; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1295 | ret = TRUE; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1296 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1297 | } |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1298 | if (type & PURPLE_MEDIA_ELEMENT_SINK) { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1299 | if (type & PURPLE_MEDIA_ELEMENT_AUDIO) { |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1300 | manager->priv->audio_sink = info; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1301 | ret = TRUE; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1302 | } |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1303 | if (type & PURPLE_MEDIA_ELEMENT_VIDEO) { |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1304 | manager->priv->video_sink = info; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1305 | ret = TRUE; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1306 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1307 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1308 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1309 | return ret; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1310 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1311 | return FALSE; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1312 | #endif |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1313 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1314 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1315 | PurpleMediaElementInfo * |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1316 | purple_media_manager_get_active_element(PurpleMediaManager *manager, |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1317 | PurpleMediaElementType type) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1318 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1319 | #ifdef USE_VV |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1320 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1321 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1322 | if (type & PURPLE_MEDIA_ELEMENT_SRC) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1323 | if (type & PURPLE_MEDIA_ELEMENT_AUDIO) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1324 | return manager->priv->audio_src; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1325 | else if (type & PURPLE_MEDIA_ELEMENT_VIDEO) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1326 | return manager->priv->video_src; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1327 | else if (type & PURPLE_MEDIA_ELEMENT_APPLICATION) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1328 | return get_send_application_element_info (); |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1329 | } else if (type & PURPLE_MEDIA_ELEMENT_SINK) { |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1330 | if (type & PURPLE_MEDIA_ELEMENT_AUDIO) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1331 | return manager->priv->audio_sink; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1332 | else if (type & PURPLE_MEDIA_ELEMENT_VIDEO) |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1333 | return manager->priv->video_sink; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1334 | else if (type & PURPLE_MEDIA_ELEMENT_APPLICATION) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1335 | return get_recv_application_element_info (); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1336 | |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1337 | } |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1338 | #endif |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1339 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1340 | return NULL; |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1341 | } |
|
26760
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
1342 | #endif /* USE_GSTREAMER */ |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1343 | |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1344 | #ifdef USE_VV |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1345 | static void |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1346 | window_id_cb(GstBus *bus, GstMessage *msg, PurpleMediaOutputWindow *ow) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1347 | { |
|
26626
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1348 | GstElement *sink; |
|
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1349 | |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1350 | if (GST_MESSAGE_TYPE(msg) != GST_MESSAGE_ELEMENT |
|
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1351 | || !gst_is_video_overlay_prepare_window_handle_message(msg)) |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1352 | return; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1353 | |
|
26626
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1354 | sink = GST_ELEMENT(GST_MESSAGE_SRC(msg)); |
|
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1355 | while (sink != ow->sink) { |
|
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1356 | if (sink == NULL) |
|
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1357 | return; |
|
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1358 | sink = GST_ELEMENT_PARENT(sink); |
|
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1359 | } |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1360 | |
|
26626
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1361 | g_signal_handlers_disconnect_matched(bus, G_SIGNAL_MATCH_FUNC |
|
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1362 | | G_SIGNAL_MATCH_DATA, 0, 0, NULL, |
|
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1363 | window_id_cb, ow); |
|
afe9f06f73d0
Fix embedding video when the sink is a gconfvideosrc pointing to an
Michael Ruprecht <maiku@pidgin.im>
parents:
26616
diff
changeset
|
1364 | |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1365 | gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(GST_MESSAGE_SRC(msg)), |
|
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1366 | ow->window_id); |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1367 | } |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1368 | #endif |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1369 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1370 | gboolean |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1371 | purple_media_manager_create_output_window(PurpleMediaManager *manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1372 | PurpleMedia *media, const gchar *session_id, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1373 | const gchar *participant) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1374 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1375 | #ifdef USE_VV |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1376 | GList *iter; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1377 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1378 | g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1379 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1380 | iter = manager->priv->output_windows; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1381 | for(; iter; iter = g_list_next(iter)) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1382 | PurpleMediaOutputWindow *ow = iter->data; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1383 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1384 | if (ow->sink == NULL && ow->media == media && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1385 | ((participant != NULL && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1386 | ow->participant != NULL && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1387 | !strcmp(participant, ow->participant)) || |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1388 | (participant == ow->participant)) && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1389 | !strcmp(session_id, ow->session_id)) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1390 | GstBus *bus; |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1391 | GstElement *queue, *convert; |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1392 | GstElement *tee = purple_media_get_tee(media, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1393 | session_id, participant); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1394 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1395 | if (tee == NULL) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1396 | continue; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1397 | |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1398 | queue = gst_element_factory_make("queue", NULL); |
|
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1399 | convert = gst_element_factory_make("videoconvert", NULL); |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1400 | ow->sink = purple_media_manager_get_element( |
|
26522
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26520
diff
changeset
|
1401 | manager, PURPLE_MEDIA_RECV_VIDEO, |
|
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26520
diff
changeset
|
1402 | ow->media, ow->session_id, |
|
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26520
diff
changeset
|
1403 | ow->participant); |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1404 | |
|
26427
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1405 | if (participant == NULL) { |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1406 | /* aka this is a preview sink */ |
|
26427
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1407 | GObjectClass *klass = |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1408 | G_OBJECT_GET_CLASS(ow->sink); |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1409 | if (g_object_class_find_property(klass, |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1410 | "sync")) |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1411 | g_object_set(G_OBJECT(ow->sink), |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1412 | "sync", FALSE, NULL); |
|
26427
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1413 | if (g_object_class_find_property(klass, |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1414 | "async")) |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1415 | g_object_set(G_OBJECT(ow->sink), |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1416 | "async", FALSE, NULL); |
|
cc660e80275f
Silence warning about videotestsrc not having two properties.
Michael Ruprecht <maiku@pidgin.im>
parents:
26329
diff
changeset
|
1417 | } |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1418 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1419 | gst_bin_add_many(GST_BIN(GST_ELEMENT_PARENT(tee)), |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1420 | queue, convert, ow->sink, NULL); |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1421 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1422 | bus = gst_pipeline_get_bus(GST_PIPELINE( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1423 | manager->priv->pipeline)); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1424 | g_signal_connect(bus, "sync-message::element", |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1425 | G_CALLBACK(window_id_cb), ow); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1426 | gst_object_unref(bus); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1427 | |
|
28140
bbb3777dbe3e
Switch around some GStreamer linking and state setting.
Michael Ruprecht <maiku@pidgin.im>
parents:
28132
diff
changeset
|
1428 | gst_element_set_state(ow->sink, GST_STATE_PLAYING); |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1429 | gst_element_set_state(convert, GST_STATE_PLAYING); |
|
28140
bbb3777dbe3e
Switch around some GStreamer linking and state setting.
Michael Ruprecht <maiku@pidgin.im>
parents:
28132
diff
changeset
|
1430 | gst_element_set_state(queue, GST_STATE_PLAYING); |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1431 | gst_element_link(convert, ow->sink); |
|
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36280
diff
changeset
|
1432 | gst_element_link(queue, convert); |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1433 | gst_element_link(tee, queue); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1434 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1435 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1436 | return TRUE; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1437 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1438 | return FALSE; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1439 | #endif |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1440 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1441 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1442 | gulong |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1443 | purple_media_manager_set_output_window(PurpleMediaManager *manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1444 | PurpleMedia *media, const gchar *session_id, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1445 | const gchar *participant, gulong window_id) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1446 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1447 | #ifdef USE_VV |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1448 | PurpleMediaOutputWindow *output_window; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1449 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1450 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1451 | g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1452 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1453 | output_window = g_new0(PurpleMediaOutputWindow, 1); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1454 | output_window->id = manager->priv->next_output_window_id++; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1455 | output_window->media = media; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1456 | output_window->session_id = g_strdup(session_id); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1457 | output_window->participant = g_strdup(participant); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1458 | output_window->window_id = window_id; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1459 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1460 | manager->priv->output_windows = g_list_prepend( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1461 | manager->priv->output_windows, output_window); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1462 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1463 | if (purple_media_get_tee(media, session_id, participant) != NULL) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1464 | purple_media_manager_create_output_window(manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1465 | media, session_id, participant); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1466 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1467 | return output_window->id; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1468 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1469 | return 0; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1470 | #endif |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1471 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1472 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1473 | gboolean |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1474 | purple_media_manager_remove_output_window(PurpleMediaManager *manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1475 | gulong output_window_id) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1476 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1477 | #ifdef USE_VV |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1478 | PurpleMediaOutputWindow *output_window = NULL; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1479 | GList *iter; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1480 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1481 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1482 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1483 | iter = manager->priv->output_windows; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1484 | for (; iter; iter = g_list_next(iter)) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1485 | PurpleMediaOutputWindow *ow = iter->data; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1486 | if (ow->id == output_window_id) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1487 | manager->priv->output_windows = g_list_delete_link( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1488 | manager->priv->output_windows, iter); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1489 | output_window = ow; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1490 | break; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1491 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1492 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1493 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1494 | if (output_window == NULL) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1495 | return FALSE; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1496 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1497 | if (output_window->sink != NULL) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1498 | GstPad *pad = gst_element_get_static_pad( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1499 | output_window->sink, "sink"); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1500 | GstPad *peer = gst_pad_get_peer(pad); |
|
28161
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1501 | GstElement *colorspace = GST_ELEMENT_PARENT(peer), *queue; |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1502 | gst_object_unref(pad); |
|
28161
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1503 | gst_object_unref(peer); |
|
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1504 | pad = gst_element_get_static_pad(colorspace, "sink"); |
|
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1505 | peer = gst_pad_get_peer(pad); |
|
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1506 | queue = GST_ELEMENT_PARENT(peer); |
|
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1507 | gst_object_unref(pad); |
|
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1508 | gst_object_unref(peer); |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1509 | pad = gst_element_get_static_pad(queue, "sink"); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1510 | peer = gst_pad_get_peer(pad); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1511 | gst_object_unref(pad); |
|
27926
7ed64195754d
Don't crash when there isn't a webcam connected.
Michael Ruprecht <maiku@pidgin.im>
parents:
26792
diff
changeset
|
1512 | if (peer != NULL) |
|
7ed64195754d
Don't crash when there isn't a webcam connected.
Michael Ruprecht <maiku@pidgin.im>
parents:
26792
diff
changeset
|
1513 | gst_element_release_request_pad(GST_ELEMENT_PARENT(peer), peer); |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1514 | gst_element_set_locked_state(queue, TRUE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1515 | gst_element_set_state(queue, GST_STATE_NULL); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1516 | gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(queue)), queue); |
|
28161
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1517 | gst_element_set_locked_state(colorspace, TRUE); |
|
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1518 | gst_element_set_state(colorspace, GST_STATE_NULL); |
|
4368c139d67f
Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
28140
diff
changeset
|
1519 | gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(colorspace)), colorspace); |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1520 | gst_element_set_locked_state(output_window->sink, TRUE); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1521 | gst_element_set_state(output_window->sink, GST_STATE_NULL); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1522 | gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(output_window->sink)), |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1523 | output_window->sink); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1524 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1525 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1526 | g_free(output_window->session_id); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1527 | g_free(output_window->participant); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1528 | g_free(output_window); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1529 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1530 | return TRUE; |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1531 | #else |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1532 | return FALSE; |
|
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1533 | #endif |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1534 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1535 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1536 | void |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1537 | purple_media_manager_remove_output_windows(PurpleMediaManager *manager, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1538 | PurpleMedia *media, const gchar *session_id, |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1539 | const gchar *participant) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1540 | { |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1541 | #ifdef USE_VV |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1542 | GList *iter; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1543 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1544 | g_return_if_fail(PURPLE_IS_MEDIA(media)); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1545 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1546 | iter = manager->priv->output_windows; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1547 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1548 | for (; iter;) { |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1549 | PurpleMediaOutputWindow *ow = iter->data; |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1550 | iter = g_list_next(iter); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1551 | |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1552 | if (media == ow->media && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1553 | ((session_id != NULL && ow->session_id != NULL && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1554 | !strcmp(session_id, ow->session_id)) || |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1555 | (session_id == ow->session_id)) && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1556 | ((participant != NULL && ow->participant != NULL && |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1557 | !strcmp(participant, ow->participant)) || |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1558 | (participant == ow->participant))) |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1559 | purple_media_manager_remove_output_window( |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1560 | manager, ow->id); |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1561 | } |
|
26480
5c4ab4baeb32
Properly wrap media functions so the API doesn't disappear when USE_VV
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
1562 | #endif |
|
26323
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1563 | } |
|
cf93de98325c
Only create output windows once there's data to be output.
Michael Ruprecht <maiku@pidgin.im>
parents:
26320
diff
changeset
|
1564 | |
|
26520
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1565 | void |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1566 | purple_media_manager_set_ui_caps(PurpleMediaManager *manager, |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1567 | PurpleMediaCaps caps) |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1568 | { |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1569 | #ifdef USE_VV |
|
29540
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1570 | PurpleMediaCaps oldcaps; |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1571 | |
|
26520
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1572 | g_return_if_fail(PURPLE_IS_MEDIA_MANAGER(manager)); |
|
29540
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1573 | |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1574 | oldcaps = manager->priv->ui_caps; |
|
26520
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1575 | manager->priv->ui_caps = caps; |
|
29540
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1576 | |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1577 | if (caps != oldcaps) |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1578 | g_signal_emit(manager, |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1579 | purple_media_manager_signals[UI_CAPS_CHANGED], |
|
6d554484fbf7
Added the ui-caps-changed signal to the media manager.
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1580 | 0, caps, oldcaps); |
|
26520
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1581 | #endif |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1582 | } |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1583 | |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1584 | PurpleMediaCaps |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1585 | purple_media_manager_get_ui_caps(PurpleMediaManager *manager) |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1586 | { |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1587 | #ifdef USE_VV |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1588 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1589 | PURPLE_MEDIA_CAPS_NONE); |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1590 | return manager->priv->ui_caps; |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1591 | #else |
|
26640
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
1592 | return PURPLE_MEDIA_CAPS_NONE; |
|
26520
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1593 | #endif |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1594 | } |
|
8cbe60f17f3b
Add purple_media_manager_{get,set}_ui_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26511
diff
changeset
|
1595 | |
|
29620
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1596 | void |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1597 | purple_media_manager_set_backend_type(PurpleMediaManager *manager, |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1598 | GType backend_type) |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1599 | { |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1600 | #ifdef USE_VV |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1601 | g_return_if_fail(PURPLE_IS_MEDIA_MANAGER(manager)); |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1602 | |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1603 | manager->priv->backend_type = backend_type; |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1604 | #endif |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1605 | } |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1606 | |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1607 | GType |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1608 | purple_media_manager_get_backend_type(PurpleMediaManager *manager) |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29620
diff
changeset
|
1609 | { |
|
29620
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1610 | #ifdef USE_VV |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1611 | g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1612 | PURPLE_MEDIA_CAPS_NONE); |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1613 | |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1614 | return manager->priv->backend_type; |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1615 | #else |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1616 | return G_TYPE_NONE; |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1617 | #endif |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1618 | } |
|
86e4f028f910
Add a way to set and get which media backend type to use.
Michael Ruprecht <maiku@pidgin.im>
parents:
29565
diff
changeset
|
1619 | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1620 | void |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1621 | purple_media_manager_set_application_data_callbacks(PurpleMediaManager *manager, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1622 | PurpleMedia *media, const gchar *session_id, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1623 | const gchar *participant, PurpleMediaAppDataCallbacks *callbacks, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1624 | gpointer user_data, GDestroyNotify notify) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1625 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1626 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1627 | PurpleMediaAppDataInfo * info = ensure_app_data_info_and_lock (manager, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1628 | media, session_id, participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1629 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1630 | if (info->notify) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1631 | info->notify (info->user_data); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1632 | |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
1633 | if (info->readable_cb_token) { |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1634 | purple_timeout_remove (info->readable_timer_id); |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
1635 | info->readable_cb_token = 0; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1636 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1637 | |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
1638 | if (info->writable_cb_token) { |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1639 | purple_timeout_remove (info->writable_timer_id); |
|
37236
79fe6b95f105
Fix a race condition in appsrc read/write callbacks
Jakub Adam <jakub.adam@ktknet.cz>
parents:
36333
diff
changeset
|
1640 | info->writable_cb_token = 0; |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1641 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1642 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1643 | if (callbacks) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1644 | info->callbacks = *callbacks; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1645 | } else { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1646 | info->callbacks.writable = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1647 | info->callbacks.readable = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1648 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1649 | info->user_data = user_data; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1650 | info->notify = notify; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1651 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1652 | call_appsrc_writable_locked (info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1653 | if (info->num_samples > 0 || info->current_sample != NULL) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1654 | call_appsink_readable_locked (info); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1655 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1656 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1657 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1658 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1659 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1660 | gint |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1661 | purple_media_manager_send_application_data ( |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1662 | PurpleMediaManager *manager, PurpleMedia *media, const gchar *session_id, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1663 | const gchar *participant, gpointer buffer, guint size, gboolean blocking) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1664 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1665 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1666 | PurpleMediaAppDataInfo * info = get_app_data_info_and_lock (manager, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1667 | media, session_id, participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1668 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1669 | if (info && info->appsrc && info->connected) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1670 | GstBuffer *gstbuffer = gst_buffer_new_wrapped (g_memdup (buffer, size), |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1671 | size); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1672 | GstAppSrc *appsrc = gst_object_ref (info->appsrc); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1673 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1674 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1675 | if (gst_app_src_push_buffer (appsrc, gstbuffer) == GST_FLOW_OK) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1676 | if (blocking) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1677 | GstPad *srcpad; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1678 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1679 | srcpad = gst_element_get_static_pad (GST_ELEMENT (appsrc), |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1680 | "src"); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1681 | if (srcpad) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1682 | gst_pad_peer_query (srcpad, gst_query_new_drain ()); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1683 | gst_object_unref (srcpad); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1684 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1685 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1686 | gst_object_unref (appsrc); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1687 | return size; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1688 | } else { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1689 | gst_object_unref (appsrc); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1690 | return -1; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1691 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1692 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1693 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1694 | return -1; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1695 | #else |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1696 | return -1; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1697 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1698 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1699 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1700 | gint |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1701 | purple_media_manager_receive_application_data ( |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1702 | PurpleMediaManager *manager, PurpleMedia *media, const gchar *session_id, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1703 | const gchar *participant, gpointer buffer, guint max_size, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1704 | gboolean blocking) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1705 | { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1706 | #ifdef HAVE_MEDIA_APPLICATION |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1707 | PurpleMediaAppDataInfo * info = get_app_data_info_and_lock (manager, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1708 | media, session_id, participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1709 | guint bytes_read = 0; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1710 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1711 | if (info) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1712 | /* If we are in a blocking read, we need to loop until max_size data |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1713 | * is read into the buffer, if we're not, then we need to read as much |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1714 | * data as possible |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1715 | */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1716 | do { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1717 | if (!info->current_sample && info->appsink && info->num_samples > 0) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1718 | info->current_sample = gst_app_sink_pull_sample (info->appsink); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1719 | info->sample_offset = 0; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1720 | if (info->current_sample) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1721 | info->num_samples--; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1722 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1723 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1724 | if (info->current_sample) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1725 | GstBuffer *gstbuffer = gst_sample_get_buffer ( |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1726 | info->current_sample); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1727 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1728 | if (gstbuffer) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1729 | GstMapInfo mapinfo; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1730 | guint bytes_to_copy; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1731 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1732 | gst_buffer_map (gstbuffer, &mapinfo, GST_MAP_READ); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1733 | /* We must copy only the data remaining in the buffer without |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1734 | * overflowing the buffer */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1735 | bytes_to_copy = max_size - bytes_read; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1736 | if (bytes_to_copy > mapinfo.size - info->sample_offset) |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1737 | bytes_to_copy = mapinfo.size - info->sample_offset; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1738 | memcpy ((guint8 *)buffer + bytes_read, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1739 | mapinfo.data + info->sample_offset, bytes_to_copy); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1740 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1741 | gst_buffer_unmap (gstbuffer, &mapinfo); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1742 | info->sample_offset += bytes_to_copy; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1743 | bytes_read += bytes_to_copy; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1744 | if (info->sample_offset == mapinfo.size) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1745 | gst_sample_unref (info->current_sample); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1746 | info->current_sample = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1747 | info->sample_offset = 0; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1748 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1749 | } else { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1750 | /* In case there's no buffer in the sample (should never |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1751 | * happen), we need to at least unref it */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1752 | gst_sample_unref (info->current_sample); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1753 | info->current_sample = NULL; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1754 | info->sample_offset = 0; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1755 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1756 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1757 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1758 | /* If blocking, wait until there's an available sample */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1759 | while (bytes_read < max_size && blocking && |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1760 | info->current_sample == NULL && info->num_samples == 0) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1761 | g_cond_wait (&info->readable_cond, &manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1762 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1763 | /* We've been signaled, we need to unlock and regrab the info |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1764 | * struct to make sure nothing changed */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1765 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1766 | info = get_app_data_info_and_lock (manager, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1767 | media, session_id, participant); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1768 | if (info == NULL || info->appsink == NULL) { |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1769 | /* The session was destroyed while we were waiting, we |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1770 | * should return here */ |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1771 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1772 | return bytes_read; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1773 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1774 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1775 | } while (bytes_read < max_size && |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1776 | (blocking || info->num_samples > 0)); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1777 | |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1778 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1779 | return bytes_read; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1780 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1781 | g_mutex_unlock (&manager->priv->appdata_mutex); |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1782 | return -1; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1783 | #else |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1784 | return -1; |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1785 | #endif |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1786 | } |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1787 | |
|
26760
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
1788 | #ifdef USE_GSTREAMER |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1789 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1790 | /* |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1791 | * PurpleMediaElementType |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1792 | */ |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1793 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1794 | GType |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1795 | purple_media_element_type_get_type() |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1796 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1797 | static GType type = 0; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1798 | if (type == 0) { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1799 | static const GFlagsValue values[] = { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1800 | { PURPLE_MEDIA_ELEMENT_NONE, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1801 | "PURPLE_MEDIA_ELEMENT_NONE", "none" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1802 | { PURPLE_MEDIA_ELEMENT_AUDIO, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1803 | "PURPLE_MEDIA_ELEMENT_AUDIO", "audio" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1804 | { PURPLE_MEDIA_ELEMENT_VIDEO, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1805 | "PURPLE_MEDIA_ELEMENT_VIDEO", "video" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1806 | { PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1807 | "PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1808 | "audio-video" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1809 | { PURPLE_MEDIA_ELEMENT_NO_SRCS, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1810 | "PURPLE_MEDIA_ELEMENT_NO_SRCS", "no-srcs" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1811 | { PURPLE_MEDIA_ELEMENT_ONE_SRC, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1812 | "PURPLE_MEDIA_ELEMENT_ONE_SRC", "one-src" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1813 | { PURPLE_MEDIA_ELEMENT_MULTI_SRC, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1814 | "PURPLE_MEDIA_ELEMENT_MULTI_SRC", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1815 | "multi-src" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1816 | { PURPLE_MEDIA_ELEMENT_REQUEST_SRC, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1817 | "PURPLE_MEDIA_ELEMENT_REQUEST_SRC", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1818 | "request-src" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1819 | { PURPLE_MEDIA_ELEMENT_NO_SINKS, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1820 | "PURPLE_MEDIA_ELEMENT_NO_SINKS", "no-sinks" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1821 | { PURPLE_MEDIA_ELEMENT_ONE_SINK, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1822 | "PURPLE_MEDIA_ELEMENT_ONE_SINK", "one-sink" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1823 | { PURPLE_MEDIA_ELEMENT_MULTI_SINK, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1824 | "PURPLE_MEDIA_ELEMENT_MULTI_SINK", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1825 | "multi-sink" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1826 | { PURPLE_MEDIA_ELEMENT_REQUEST_SINK, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1827 | "PURPLE_MEDIA_ELEMENT_REQUEST_SINK", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1828 | "request-sink" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1829 | { PURPLE_MEDIA_ELEMENT_UNIQUE, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1830 | "PURPLE_MEDIA_ELEMENT_UNIQUE", "unique" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1831 | { PURPLE_MEDIA_ELEMENT_SRC, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1832 | "PURPLE_MEDIA_ELEMENT_SRC", "src" }, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1833 | { PURPLE_MEDIA_ELEMENT_SINK, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1834 | "PURPLE_MEDIA_ELEMENT_SINK", "sink" }, |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1835 | { PURPLE_MEDIA_ELEMENT_APPLICATION, |
|
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
1836 | "PURPLE_MEDIA_ELEMENT_APPLICATION", "application" }, |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1837 | { 0, NULL, NULL } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1838 | }; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1839 | type = g_flags_register_static( |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1840 | "PurpleMediaElementType", values); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1841 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1842 | return type; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1843 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1844 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1845 | /* |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1846 | * PurpleMediaElementInfo |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1847 | */ |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1848 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1849 | struct _PurpleMediaElementInfoClass |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1850 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1851 | GObjectClass parent_class; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1852 | }; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1853 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1854 | struct _PurpleMediaElementInfo |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1855 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1856 | GObject parent; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1857 | }; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1858 | |
|
26640
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
1859 | #ifdef USE_VV |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1860 | struct _PurpleMediaElementInfoPrivate |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1861 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1862 | gchar *id; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1863 | gchar *name; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1864 | PurpleMediaElementType type; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1865 | PurpleMediaElementCreateCallback create; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1866 | }; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1867 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1868 | enum { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1869 | PROP_0, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1870 | PROP_ID, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1871 | PROP_NAME, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1872 | PROP_TYPE, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1873 | PROP_CREATE_CB, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1874 | }; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1875 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1876 | static void |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1877 | purple_media_element_info_init(PurpleMediaElementInfo *info) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1878 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1879 | PurpleMediaElementInfoPrivate *priv = |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1880 | PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(info); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1881 | priv->id = NULL; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1882 | priv->name = NULL; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1883 | priv->type = PURPLE_MEDIA_ELEMENT_NONE; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1884 | priv->create = NULL; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1885 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1886 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1887 | static void |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1888 | purple_media_element_info_finalize(GObject *info) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1889 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1890 | PurpleMediaElementInfoPrivate *priv = |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1891 | PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(info); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1892 | g_free(priv->id); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1893 | g_free(priv->name); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1894 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1895 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1896 | static void |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1897 | purple_media_element_info_set_property (GObject *object, guint prop_id, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1898 | const GValue *value, GParamSpec *pspec) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1899 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1900 | PurpleMediaElementInfoPrivate *priv; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1901 | g_return_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(object)); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1902 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1903 | priv = PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(object); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1904 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1905 | switch (prop_id) { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1906 | case PROP_ID: |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1907 | g_free(priv->id); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1908 | priv->id = g_value_dup_string(value); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1909 | break; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1910 | case PROP_NAME: |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1911 | g_free(priv->name); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1912 | priv->name = g_value_dup_string(value); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1913 | break; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1914 | case PROP_TYPE: { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1915 | priv->type = g_value_get_flags(value); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1916 | break; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1917 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1918 | case PROP_CREATE_CB: |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1919 | priv->create = g_value_get_pointer(value); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1920 | break; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29620
diff
changeset
|
1921 | default: |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1922 | G_OBJECT_WARN_INVALID_PROPERTY_ID( |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1923 | object, prop_id, pspec); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1924 | break; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1925 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1926 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1927 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1928 | static void |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1929 | purple_media_element_info_get_property (GObject *object, guint prop_id, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1930 | GValue *value, GParamSpec *pspec) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1931 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1932 | PurpleMediaElementInfoPrivate *priv; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1933 | g_return_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(object)); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29620
diff
changeset
|
1934 | |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1935 | priv = PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(object); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1936 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1937 | switch (prop_id) { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1938 | case PROP_ID: |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1939 | g_value_set_string(value, priv->id); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1940 | break; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1941 | case PROP_NAME: |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1942 | g_value_set_string(value, priv->name); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1943 | break; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1944 | case PROP_TYPE: |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1945 | g_value_set_flags(value, priv->type); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1946 | break; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1947 | case PROP_CREATE_CB: |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1948 | g_value_set_pointer(value, priv->create); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1949 | break; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29620
diff
changeset
|
1950 | default: |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1951 | G_OBJECT_WARN_INVALID_PROPERTY_ID( |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1952 | object, prop_id, pspec); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1953 | break; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1954 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1955 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1956 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1957 | static void |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1958 | purple_media_element_info_class_init(PurpleMediaElementInfoClass *klass) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1959 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1960 | GObjectClass *gobject_class = (GObjectClass*)klass; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29620
diff
changeset
|
1961 | |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1962 | gobject_class->finalize = purple_media_element_info_finalize; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1963 | gobject_class->set_property = purple_media_element_info_set_property; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1964 | gobject_class->get_property = purple_media_element_info_get_property; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1965 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1966 | g_object_class_install_property(gobject_class, PROP_ID, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1967 | g_param_spec_string("id", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1968 | "ID", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1969 | "The unique identifier of the element.", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1970 | NULL, |
|
35063
8ac1510a27ae
media: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34993
diff
changeset
|
1971 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | |
|
8ac1510a27ae
media: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34993
diff
changeset
|
1972 | G_PARAM_STATIC_STRINGS)); |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1973 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1974 | g_object_class_install_property(gobject_class, PROP_NAME, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1975 | g_param_spec_string("name", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1976 | "Name", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1977 | "The friendly/display name of this element.", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1978 | NULL, |
|
35063
8ac1510a27ae
media: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34993
diff
changeset
|
1979 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | |
|
8ac1510a27ae
media: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34993
diff
changeset
|
1980 | G_PARAM_STATIC_STRINGS)); |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1981 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1982 | g_object_class_install_property(gobject_class, PROP_TYPE, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1983 | g_param_spec_flags("type", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1984 | "Element Type", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1985 | "The type of element this is.", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1986 | PURPLE_TYPE_MEDIA_ELEMENT_TYPE, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1987 | PURPLE_MEDIA_ELEMENT_NONE, |
|
35063
8ac1510a27ae
media: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34993
diff
changeset
|
1988 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | |
|
8ac1510a27ae
media: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34993
diff
changeset
|
1989 | G_PARAM_STATIC_STRINGS)); |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1990 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1991 | g_object_class_install_property(gobject_class, PROP_CREATE_CB, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1992 | g_param_spec_pointer("create-cb", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1993 | "Create Callback", |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1994 | "The function called to create this element.", |
|
35063
8ac1510a27ae
media: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34993
diff
changeset
|
1995 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | |
|
8ac1510a27ae
media: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34993
diff
changeset
|
1996 | G_PARAM_STATIC_STRINGS)); |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1997 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1998 | g_type_class_add_private(klass, sizeof(PurpleMediaElementInfoPrivate)); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
1999 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2000 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2001 | G_DEFINE_TYPE(PurpleMediaElementInfo, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2002 | purple_media_element_info, G_TYPE_OBJECT); |
|
26640
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
2003 | #else |
|
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
2004 | GType |
|
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
2005 | purple_media_element_info_get_type() |
|
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
2006 | { |
|
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
2007 | return G_TYPE_NONE; |
|
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
2008 | } |
|
eba80d2f198f
Make it compile with --disable-vv... again!
Michael Ruprecht <maiku@pidgin.im>
parents:
26626
diff
changeset
|
2009 | #endif |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2010 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2011 | gchar * |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2012 | purple_media_element_info_get_id(PurpleMediaElementInfo *info) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2013 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2014 | #ifdef USE_VV |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2015 | gchar *id; |
| 36289 | 2016 | |
|
36291
5ebc548740cc
Fix rest of _get_instance_private errors for glib < 2.37.3
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36289
diff
changeset
|
2017 | #if GLIB_CHECK_VERSION(2, 37, 3) |
| 36289 | 2018 | /* Silence a warning. This could be anywhere below G_DEFINE_TYPE */ |
| 2019 | (void)purple_media_element_info_get_instance_private; | |
|
36291
5ebc548740cc
Fix rest of _get_instance_private errors for glib < 2.37.3
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36289
diff
changeset
|
2020 | #endif |
| 36289 | 2021 | |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2022 | g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), NULL); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2023 | g_object_get(info, "id", &id, NULL); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2024 | return id; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2025 | #else |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2026 | return NULL; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2027 | #endif |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2028 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2029 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2030 | gchar * |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2031 | purple_media_element_info_get_name(PurpleMediaElementInfo *info) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2032 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2033 | #ifdef USE_VV |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2034 | gchar *name; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2035 | g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), NULL); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2036 | g_object_get(info, "name", &name, NULL); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2037 | return name; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2038 | #else |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2039 | return NULL; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2040 | #endif |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2041 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2042 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2043 | PurpleMediaElementType |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2044 | purple_media_element_info_get_element_type(PurpleMediaElementInfo *info) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2045 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2046 | #ifdef USE_VV |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2047 | PurpleMediaElementType type; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2048 | g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2049 | PURPLE_MEDIA_ELEMENT_NONE); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2050 | g_object_get(info, "type", &type, NULL); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2051 | return type; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2052 | #else |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2053 | return PURPLE_MEDIA_ELEMENT_NONE; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2054 | #endif |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2055 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2056 | |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2057 | GstElement * |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2058 | purple_media_element_info_call_create(PurpleMediaElementInfo *info, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2059 | PurpleMedia *media, const gchar *session_id, |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2060 | const gchar *participant) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2061 | { |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2062 | #ifdef USE_VV |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2063 | PurpleMediaElementCreateCallback create; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2064 | g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), NULL); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2065 | g_object_get(info, "create-cb", &create, NULL); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2066 | if (create) |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2067 | return create(media, session_id, participant); |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2068 | #endif |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2069 | return NULL; |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2070 | } |
|
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26614
diff
changeset
|
2071 | |
|
36333
4fe1034f3dce
Add application media type and APIs
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents:
36331
diff
changeset
|
2072 | |
|
26760
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
2073 | #endif /* USE_GSTREAMER */ |
|
251146cb6d09
Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26748
diff
changeset
|
2074 |