Screen sharing from Pidgin
David Woodhouse
dwmw2 at infradead.org
Tue Apr 17 18:54:26 EDT 2018
On Sat, 2018-04-14 at 22:14 +0200, David Woodhouse wrote:
> I'm working on screen sharing. It's just another video screen, but the
> GStreamer src element is (in my case) ximagesrc instead v4l2src.
>
> I suspect the best way to handle it is to define a new media type
> PURPLE_MEDIA_SEND_SCREEN. It's then left to the UI (e.g. Pidgin) to
> register an appropriate src element according to the windowing system
> in use (be it X11, Wayland, Windows, OSX, etc.), and to handle advanced
> things like choosing whether to share the whole display, or just one
> monitor, or just one window.
After looking at this a bit, I have revised the plan. In create_src()
in libpurple/media/backend-fs2.c we end up converting the media type to
and from FsMediaType, so it would need a FS_MEDIA_TYPE_SCREEN too, and
as far as FarStream is concerned is really *is* just video.
Also, that function is currently called synchronously and is expected
to immediately return the correct src element. Interacting with the
user to ask which screen/window would be slightly non-trivial.
Looks like a better option is to create the specific src element in
advance, just before creating the media stream. Then the libpurple side
becomes *really* simple...
diff --git a/libpurple/media/enum-types.h b/libpurple/media/enum-types.h
index f61d66c..9f35222 100644
--- a/libpurple/media/enum-types.h
+++ b/libpurple/media/enum-types.h
@@ -99,7 +99,11 @@ typedef enum {
PURPLE_MEDIA_AUDIO = PURPLE_MEDIA_RECV_AUDIO | PURPLE_MEDIA_SEND_AUDIO,
PURPLE_MEDIA_VIDEO = PURPLE_MEDIA_RECV_VIDEO | PURPLE_MEDIA_SEND_VIDEO,
PURPLE_MEDIA_APPLICATION = PURPLE_MEDIA_RECV_APPLICATION |
- PURPLE_MEDIA_SEND_APPLICATION
+ PURPLE_MEDIA_SEND_APPLICATION,
+ PURPLE_MEDIA_SEND = PURPLE_MEDIA_SEND_AUDIO | PURPLE_MEDIA_SEND_VIDEO |
+ PURPLE_MEDIA_SEND_APPLICATION,
+ PURPLE_MEDIA_RECV = PURPLE_MEDIA_RECV_AUDIO | PURPLE_MEDIA_RECV_VIDEO |
+ PURPLE_MEDIA_RECV_APPLICATION
} PurpleMediaSessionType;
/** Media state-changed types */
diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
index 49bb9dc..605b7dc 100644
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -1191,6 +1191,12 @@ purple_media_manager_get_element(PurpleMediaManager *manager,
PurpleMediaElementInfo *info = NULL;
PurpleMediaElementType element_type;
+ if (type & PURPLE_MEDIA_SEND)
+ info = g_object_get_data(G_OBJECT(media), "src-element");
+ else
+ info = g_object_get_data(G_OBJECT(media), "sink-element");
+
+ if (info == NULL) {
if (type & PURPLE_MEDIA_SEND_AUDIO)
info = manager->priv->audio_src;
else if (type & PURPLE_MEDIA_RECV_AUDIO)
@@ -1203,6 +1209,7 @@ purple_media_manager_get_element(PurpleMediaManager *manager,
info = get_send_application_element_info ();
else if (type & PURPLE_MEDIA_RECV_APPLICATION)
info = get_recv_application_element_info ();
+ }
if (info == NULL)
return NULL;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5213 bytes
Desc: not available
URL: <https://pidgin.im/pipermail/devel/attachments/20180417/3d5ad760/attachment.bin>
More information about the Devel
mailing list