ximagesrc: fix compile-time warning and XInitThreads()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5493>
This commit is contained in:
robert 2023-10-16 20:53:49 +00:00 committed by GStreamer Marge Bot
parent 3dd9411b36
commit 737c32b9b6
2 changed files with 18 additions and 4 deletions

View file

@ -22,11 +22,18 @@
* SECTION:element-ximagesrc
* @title: ximagesrc
*
* This element captures your X Display and creates raw RGB video. It uses
* This element captures your X Display and creates raw RGB video. It uses
* the XDamage extension if available to only capture areas of the screen that
* have changed since the last frame. It uses the XFixes extension if
* available to also capture your mouse pointer. It supports handling of
* mouse and keyboard events. By default it will fixate to 25 frames per second.
*
* Applications are expected to call `XinitThreads()` before any other threads
* are started. For use in gst-launch-1.0 or other GStreamer command line
* applications it is also possible to set the GST_XINITTHREADS=1 environment
* variable so that `XInitThreads()` gets called when the plugin is loaded. This
* may be too late in other use case scenarios though, so applications should
* not rely on that.
*
* ## Example pipelines
* |[
@ -1398,10 +1405,7 @@ gst_ximage_src_class_init (GstXImageSrcClass * klass)
bc->stop = gst_ximage_src_stop;
bc->unlock = gst_ximage_src_unlock;
push_class->create = gst_ximage_src_create;
#ifdef HAVE_NAVIGATION
XInitThreads ();
bc->event = gst_ximage_src_event;
#endif /* HAVE_NAVIGATION */
}
static void
@ -1429,6 +1433,9 @@ plugin_init (GstPlugin * plugin)
{
gboolean ret;
if (g_getenv ("GST_XINITTHREADS"))
XInitThreads ();
GST_DEBUG_CATEGORY_INIT (gst_debug_ximage_src, "ximagesrc", 0,
"ximagesrc element debug");

View file

@ -343,3 +343,10 @@ Example: `GST_PLUGIN_FEATURE_RANK=foo:PRIMARY,bar:primary,foobar:128`
As a result of the above example,
the `foo` and` bar` plugin feature rank values are `PRIMARY`(256)
and `SECONDARY`(128) rank value will be assigned to `foobar`.
**`GST_XINITTHREADS`.**
Set this variable when using components that rely on X11, such as ximagesrc,
from gst-launch-1.0 or other command line applications. However, applications
should not depend on this variable and should make their own `XInitThreads()`
call as early as possible.