Screen capture in GTK+ application

Nicolas Dufresne nicolas at ndufresne.ca
Tue Apr 17 11:54:53 UTC 2018


Le mardi 17 avril 2018 à 11:44 +0100, David Woodhouse a écrit :
> I tried using ximagesrc as a video source in Pidgin (which is still
> using GTK2+, FWIW). It fell over:
>  [xcb] Most likely this is a multi-threaded client and XInitThreads
> has not been called
>  [xcb] Aborting, sorry about that.
> 
> Is ximagesrc just not expected to work in threaded GTK programs? That
> might be worth mentioning in its documentation...

It's exactly what the error says. Gtk does not call XInitThreads,
because it does not do concurrent access to the display object. You
must call this function in Pidgin, before you initialize Gtk and
GStreamer. The "threading" support in Gtk only works for Gtk calls.

> 
> What's the sanest way to resolve it? Once upon a time, perhaps
> ximagesrc could have had an option to use gdk_threads_enter() around
> its XLib calls instead of just using its own mutex, perhaps? That
> doesn't seem like a viable option now though, if it ever was.
> 
> Should I create a 'gdkwindowsrc' element which works directly through
> GTK/GDK to do the captures from a given GdkWindow instead?
> 
> That might work nicely since from the application's point of view it
> would abstract away the X/Wayland/Windows/OSX differences. It could
> also be a home for a generic UI widget which allows the user to
> choose
> *what* to capture (one app, one monitor, or the entire display).
> 
> Better ideas?
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180417/2b7765e7/attachment-0001.sig>


More information about the gstreamer-devel mailing list