[Spice-devel] [PATCH v2 spice-streaming-agent 1/3] gst-plugin: Initialize X connection also when ximagesrc is used
Frediano Ziglio
fziglio at redhat.com
Wed May 1 13:16:28 UTC 2019
>
> In order to get graphic devices info a connection to X server
> is required, make sure we get it also when ximagesrc capture
> is used ( XLIB_CAPTURE=0 ).
>
> Signed-off-by: Snir Sheriber <ssheribe at redhat.com>
For the series
Acked-by: Frediano Ziglio <fziglio at redhat.com>
Frediano
> ---
>
> Changes from v1:
> -remove unnecessary check
> -make *dpy const
> -added two minor follow up patches (not really necessary)
>
>
>
> ---
> src/gst-plugin.cpp | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/src/gst-plugin.cpp b/src/gst-plugin.cpp
> index 3edf9f5..80b56ae 100644
> --- a/src/gst-plugin.cpp
> +++ b/src/gst-plugin.cpp
> @@ -84,9 +84,9 @@ private:
> GstElement *get_encoder_plugin(const GstreamerEncoderSettings &settings,
> GstCapsUPtr &sink_caps);
> GstElement *get_capture_plugin(const GstreamerEncoderSettings
> &settings);
> void pipeline_init(const GstreamerEncoderSettings &settings);
> + Display *const dpy;
> #if XLIB_CAPTURE
> void xlib_capture();
> - Display *dpy;
> XImage *image = nullptr;
> #endif
> GstObjectUPtr<GstElement> pipeline, capture, sink;
> @@ -251,13 +251,6 @@ void GstreamerFrameCapture::pipeline_init(const
> GstreamerEncoderSettings &settin
> throw std::runtime_error("Linking gstreamer's elements failed");
> }
>
> -#if XLIB_CAPTURE
> - dpy = XOpenDisplay(nullptr);
> - if (!dpy) {
> - throw std::runtime_error("Unable to initialize X11");
> - }
> -#endif
> -
> gst_element_set_state(pipeline.get(), GST_STATE_PLAYING);
>
> #if !XLIB_CAPTURE
> @@ -290,8 +283,11 @@ void GstreamerFrameCapture::pipeline_init(const
> GstreamerEncoderSettings &settin
> }
>
> GstreamerFrameCapture::GstreamerFrameCapture(const GstreamerEncoderSettings
> &settings):
> - settings(settings)
> + dpy(XOpenDisplay(nullptr)),settings(settings)
> {
> + if (!dpy) {
> + throw std::runtime_error("Unable to initialize X11");
> + }
> pipeline_init(settings);
> }
>
> @@ -313,9 +309,7 @@ GstreamerFrameCapture::~GstreamerFrameCapture()
> {
> free_sample();
> gst_element_set_state(pipeline.get(), GST_STATE_NULL);
> -#if XLIB_CAPTURE
> XCloseDisplay(dpy);
> -#endif
> }
>
> void GstreamerFrameCapture::Reset()
More information about the Spice-devel
mailing list