This patch allows the MJPEG encoder to inform the spice-widget that its video drawing area (draw-area) should be made visible on screen. This is required to switch from GST video decoding to native MJPEG decoding, otherwise the gst-area remained on top and the MJPEG video stream was never shown. Signed-off-by: Kevin Pouget <kpouget@xxxxxxxxxx> --- v2 -> v3: address Snir comments: - comment about NULL in the signal description - move 'if (pipeline_ptr == NULL) ...' outside of 'if defined(GDK_WINDOWING_X11)' regarding EGL note, it might be something like this: > gtk_stack_set_visible_child_name(d->stack, egl_enabled(d) ? > "gl-area" : "draw-area"); but it's just a wild guess! --- src/channel-display-mjpeg.c | 3 +++ src/channel-display.c | 4 +++- src/spice-widget.c | 11 +++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c index 647d31b..636a98b 100644 --- a/src/channel-display-mjpeg.c +++ b/src/channel-display-mjpeg.c @@ -300,5 +300,8 @@ VideoDecoder* create_mjpeg_decoder(int codec_type, display_stream *stream) /* All the other fields are initialized to zero by g_new0(). */ + /* makes the draw-area visible */ + hand_pipeline_to_widget(stream, NULL); + return (VideoDecoder*)decoder; } diff --git a/src/channel-display.c b/src/channel-display.c index 59c809d..cd87c7c 100644 --- a/src/channel-display.c +++ b/src/channel-display.c @@ -485,7 +485,9 @@ static void spice_display_channel_class_init(SpiceDisplayChannelClass *klass) * * The #SpiceDisplayChannel::gst-video-overlay signal is emitted when * pipeline is ready and can be passed to widget to register GStreamer - * overlay interface and other GStreamer callbacks. + * overlay interface and other GStreamer callbacks. If the pipeline + * pointer is NULL, the drawing area of the native renderer is set + * visible. * * Returns: %TRUE if the overlay is being set * diff --git a/src/spice-widget.c b/src/spice-widget.c index a9ba1f1..d73e02f 100644 --- a/src/spice-widget.c +++ b/src/spice-widget.c @@ -2780,14 +2780,20 @@ static void gst_size_allocate(GtkWidget *widget, GdkRectangle *a, gpointer data) } /* This callback should pass to the widget a pointer of the pipeline - * so that we can set pipeline and overlay related calls from here. + * so that we can the set GST pipeline and overlay related calls from + * here. If the pipeline pointer is NULL, the drawing area of the + * native renderer is set visible. */ static gboolean set_overlay(SpiceChannel *channel, void* pipeline_ptr, SpiceDisplay *display) { -#if defined(GDK_WINDOWING_X11) SpiceDisplayPrivate *d = display->priv; + if (pipeline_ptr == NULLg0) { + gtk_stack_set_visible_child_name(d->stack, "draw-area"); + return true; + } + +#if defined(GDK_WINDOWING_X11) /* GstVideoOverlay is currently used only under x */ if (!g_getenv("DISABLE_GSTVIDEOOVERLAY") && GDK_IS_X11_DISPLAY(gdk_display_get_default())) { -- 2.21.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel