gstwaylandsink: "hide" video window when pipeline is stopped

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

gstwaylandsink: "hide" video window when pipeline is stopped

Guillermo Rodriguez Garcia-2
Hello all,

I am using gstwaylandsink to render to an application supplied surface
(via the GstVideoOverlay interface). I need to control the position of
the video window, so the application creates a top-level, fully
transparent surface with the same size as the screen, then I use
set_render_rectangle to tell waylandsink where the video should
actually be drawn. This is working fine.

My problem is that when the pipeline is stopped (state set to NULL),
the video area is cleared to black, and stays on top of the
controlling application. I would need the video area to be "hidden"
instead (i.e. removed from the composition).

The thing is that looking at the code it seems that this (hiding the
window) was actually the intended behaviour. Pipeline state changes
are handled in gst_wayland_sink_change_state [1]. For the PAUSED to
READY transition, the code looks like this:

    case GST_STATE_CHANGE_PAUSED_TO_READY:
      gst_buffer_replace (&sink->last_buffer, NULL);
      if (sink->window) {
        if (gst_wl_window_is_toplevel (sink->window)) {
          g_clear_object (&sink->window);
        } else {
          /* remove buffer from surface, show nothing */
          gst_wl_window_render (sink->window, NULL, NULL);
        }
      }

In my case, sink->window is not a toplevel, so the 'else' branch runs.

gst_wl_window_render does a wl_surface_attach with a NULL buffer +
wl_surface_commit, which should actually "hide" the window. Yet for
some reason this is not what is happening.

I am probably missing something; any ideas or hints?

Thank you,

 [1] https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/ext/wayland/gstwaylandsink.c#L376

--
Guillermo Rodriguez Garcia
[hidden email]
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstwaylandsink: "hide" video window when pipeline is stopped

Nicolas Dufresne-5
Le mercredi 22 janvier 2020 à 18:36 +0100, Guillermo Rodriguez Garcia a écrit :

> Hello all,
>
> I am using gstwaylandsink to render to an application supplied surface
> (via the GstVideoOverlay interface). I need to control the position of
> the video window, so the application creates a top-level, fully
> transparent surface with the same size as the screen, then I use
> set_render_rectangle to tell waylandsink where the video should
> actually be drawn. This is working fine.
>
> My problem is that when the pipeline is stopped (state set to NULL),
> the video area is cleared to black, and stays on top of the
> controlling application. I would need the video area to be "hidden"
> instead (i.e. removed from the composition).
>
> The thing is that looking at the code it seems that this (hiding the
> window) was actually the intended behaviour. Pipeline state changes
> are handled in gst_wayland_sink_change_state [1]. For the PAUSED to
> READY transition, the code looks like this:
>
>     case GST_STATE_CHANGE_PAUSED_TO_READY:
>       gst_buffer_replace (&sink->last_buffer, NULL);
>       if (sink->window) {
>         if (gst_wl_window_is_toplevel (sink->window)) {
>           g_clear_object (&sink->window);
>         } else {
>           /* remove buffer from surface, show nothing */
>           gst_wl_window_render (sink->window, NULL, NULL);
>         }
>       }
>
> In my case, sink->window is not a toplevel, so the 'else' branch runs.
>
> gst_wl_window_render does a wl_surface_attach with a NULL buffer +
> wl_surface_commit, which should actually "hide" the window. Yet for
> some reason this is not what is happening.
>
> I am probably missing something; any ideas or hints?

Indeed, I would expect exactly what you want to happen. Which compositor is
this?

>
> Thank you,
>
>  [1]
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/ext/wayland/gstwaylandsink.c#L376
>

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstwaylandsink: "hide" video window when pipeline is stopped

Guillermo Rodriguez Garcia-2
El mié., 22 ene. 2020 a las 21:47, Nicolas Dufresne
(<[hidden email]>) escribió:

>
> Le mercredi 22 janvier 2020 à 18:36 +0100, Guillermo Rodriguez Garcia a écrit :
> > Hello all,
> >
> > I am using gstwaylandsink to render to an application supplied surface
> > (via the GstVideoOverlay interface). I need to control the position of
> > the video window, so the application creates a top-level, fully
> > transparent surface with the same size as the screen, then I use
> > set_render_rectangle to tell waylandsink where the video should
> > actually be drawn. This is working fine.
> >
> > My problem is that when the pipeline is stopped (state set to NULL),
> > the video area is cleared to black, and stays on top of the
> > controlling application. I would need the video area to be "hidden"
> > instead (i.e. removed from the composition).
> >
> > The thing is that looking at the code it seems that this (hiding the
> > window) was actually the intended behaviour. Pipeline state changes
> > are handled in gst_wayland_sink_change_state [1]. For the PAUSED to
> > READY transition, the code looks like this:
> >
> >     case GST_STATE_CHANGE_PAUSED_TO_READY:
> >       gst_buffer_replace (&sink->last_buffer, NULL);
> >       if (sink->window) {
> >         if (gst_wl_window_is_toplevel (sink->window)) {
> >           g_clear_object (&sink->window);
> >         } else {
> >           /* remove buffer from surface, show nothing */
> >           gst_wl_window_render (sink->window, NULL, NULL);
> >         }
> >       }
> >
> > In my case, sink->window is not a toplevel, so the 'else' branch runs.
> >
> > gst_wl_window_render does a wl_surface_attach with a NULL buffer +
> > wl_surface_commit, which should actually "hide" the window. Yet for
> > some reason this is not what is happening.
> >
> > I am probably missing something; any ideas or hints?
>
> Indeed, I would expect exactly what you want to happen. Which compositor is
> this?

I am using Weston in my application but I have checked and I get
exactly the same behaviour with Mutter...

Guillermo

>
> >
> > Thank you,
> >
> >  [1]
> > https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/ext/wayland/gstwaylandsink.c#L376
> >
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



--
Guillermo Rodriguez Garcia
[hidden email]
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstwaylandsink: "hide" video window when pipeline is stopped

Nicolas Dufresne-5
Le jeudi 23 janvier 2020 à 11:47 +0100, Guillermo Rodriguez Garcia a écrit :

> El mié., 22 ene. 2020 a las 21:47, Nicolas Dufresne
> (<[hidden email]>) escribió:
> > Le mercredi 22 janvier 2020 à 18:36 +0100, Guillermo Rodriguez Garcia a
> > écrit :
> > > Hello all,
> > >
> > > I am using gstwaylandsink to render to an application supplied surface
> > > (via the GstVideoOverlay interface). I need to control the position of
> > > the video window, so the application creates a top-level, fully
> > > transparent surface with the same size as the screen, then I use
> > > set_render_rectangle to tell waylandsink where the video should
> > > actually be drawn. This is working fine.
> > >
> > > My problem is that when the pipeline is stopped (state set to NULL),
> > > the video area is cleared to black, and stays on top of the
> > > controlling application. I would need the video area to be "hidden"
> > > instead (i.e. removed from the composition).
> > >
> > > The thing is that looking at the code it seems that this (hiding the
> > > window) was actually the intended behaviour. Pipeline state changes
> > > are handled in gst_wayland_sink_change_state [1]. For the PAUSED to
> > > READY transition, the code looks like this:
> > >
> > >     case GST_STATE_CHANGE_PAUSED_TO_READY:
> > >       gst_buffer_replace (&sink->last_buffer, NULL);
> > >       if (sink->window) {
> > >         if (gst_wl_window_is_toplevel (sink->window)) {
> > >           g_clear_object (&sink->window);
> > >         } else {
> > >           /* remove buffer from surface, show nothing */
> > >           gst_wl_window_render (sink->window, NULL, NULL);
> > >         }
> > >       }
> > >
> > > In my case, sink->window is not a toplevel, so the 'else' branch runs.
> > >
> > > gst_wl_window_render does a wl_surface_attach with a NULL buffer +
> > > wl_surface_commit, which should actually "hide" the window. Yet for
> > > some reason this is not what is happening.
> > >
> > > I am probably missing something; any ideas or hints?
> >
> > Indeed, I would expect exactly what you want to happen. Which compositor is
> > this?
>
> I am using Weston in my application but I have checked and I get
> exactly the same behaviour with Mutter...

Had a second thought, you said we do remove the surface on the video subsurface,
did we forgot to do the same on the backplate subsurface ? Remember there is 2
subsurfaces, one is a opaque black plane, that handle the bars when there is
padding due to pixel aspect ration adjustment. Maybe that's the problem ?

>
> Guillermo
>
> > > Thank you,
> > >
> > >  [1]
> > > https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/ext/wayland/gstwaylandsink.c#L376
> > >
> >
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstwaylandsink: "hide" video window when pipeline is stopped

Guillermo Rodriguez Garcia-2
Hi,

El jue., 23 ene. 2020 a las 17:30, Nicolas Dufresne
(<[hidden email]>) escribió:

>
> Le jeudi 23 janvier 2020 à 11:47 +0100, Guillermo Rodriguez Garcia a écrit :
> > El mié., 22 ene. 2020 a las 21:47, Nicolas Dufresne
> > (<[hidden email]>) escribió:
> > > Le mercredi 22 janvier 2020 à 18:36 +0100, Guillermo Rodriguez Garcia a
> > > écrit :
> > > > Hello all,
> > > >
> > > > I am using gstwaylandsink to render to an application supplied surface
> > > > (via the GstVideoOverlay interface). I need to control the position of
> > > > the video window, so the application creates a top-level, fully
> > > > transparent surface with the same size as the screen, then I use
> > > > set_render_rectangle to tell waylandsink where the video should
> > > > actually be drawn. This is working fine.
> > > >
> > > > My problem is that when the pipeline is stopped (state set to NULL),
> > > > the video area is cleared to black, and stays on top of the
> > > > controlling application. I would need the video area to be "hidden"
> > > > instead (i.e. removed from the composition).
> > > >
> > > > The thing is that looking at the code it seems that this (hiding the
> > > > window) was actually the intended behaviour. Pipeline state changes
> > > > are handled in gst_wayland_sink_change_state [1]. For the PAUSED to
> > > > READY transition, the code looks like this:
> > > >
> > > >     case GST_STATE_CHANGE_PAUSED_TO_READY:
> > > >       gst_buffer_replace (&sink->last_buffer, NULL);
> > > >       if (sink->window) {
> > > >         if (gst_wl_window_is_toplevel (sink->window)) {
> > > >           g_clear_object (&sink->window);
> > > >         } else {
> > > >           /* remove buffer from surface, show nothing */
> > > >           gst_wl_window_render (sink->window, NULL, NULL);
> > > >         }
> > > >       }
> > > >
> > > > In my case, sink->window is not a toplevel, so the 'else' branch runs.
> > > >
> > > > gst_wl_window_render does a wl_surface_attach with a NULL buffer +
> > > > wl_surface_commit, which should actually "hide" the window. Yet for
> > > > some reason this is not what is happening.
> > > >
> > > > I am probably missing something; any ideas or hints?
> > >
> > > Indeed, I would expect exactly what you want to happen. Which compositor is
> > > this?
> >
> > I am using Weston in my application but I have checked and I get
> > exactly the same behaviour with Mutter...
>
> Had a second thought, you said we do remove the surface on the video subsurface,
> did we forgot to do the same on the backplate subsurface ? Remember there is 2
> subsurfaces, one is a opaque black plane, that handle the bars when there is
> padding due to pixel aspect ration adjustment. Maybe that's the problem ?

Yes, exactly! I thought the video surface was being cleared to black
but that's not what
is happening. The video surface is being removed properly, but the
black surface behind
remains there.

Shall I prepare a patch for this ?

Guillermo Rodriguez Garcia
[hidden email]
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstwaylandsink: "hide" video window when pipeline is stopped

Nicolas Dufresne-5
Le jeudi 23 janvier 2020 à 17:53 +0100, Guillermo Rodriguez Garcia a écrit :

> Hi,
>
> El jue., 23 ene. 2020 a las 17:30, Nicolas Dufresne
> (<[hidden email]>) escribió:
> > Le jeudi 23 janvier 2020 à 11:47 +0100, Guillermo Rodriguez Garcia a écrit :
> > > El mié., 22 ene. 2020 a las 21:47, Nicolas Dufresne
> > > (<[hidden email]>) escribió:
> > > > Le mercredi 22 janvier 2020 à 18:36 +0100, Guillermo Rodriguez Garcia a
> > > > écrit :
> > > > > Hello all,
> > > > >
> > > > > I am using gstwaylandsink to render to an application supplied surface
> > > > > (via the GstVideoOverlay interface). I need to control the position of
> > > > > the video window, so the application creates a top-level, fully
> > > > > transparent surface with the same size as the screen, then I use
> > > > > set_render_rectangle to tell waylandsink where the video should
> > > > > actually be drawn. This is working fine.
> > > > >
> > > > > My problem is that when the pipeline is stopped (state set to NULL),
> > > > > the video area is cleared to black, and stays on top of the
> > > > > controlling application. I would need the video area to be "hidden"
> > > > > instead (i.e. removed from the composition).
> > > > >
> > > > > The thing is that looking at the code it seems that this (hiding the
> > > > > window) was actually the intended behaviour. Pipeline state changes
> > > > > are handled in gst_wayland_sink_change_state [1]. For the PAUSED to
> > > > > READY transition, the code looks like this:
> > > > >
> > > > >     case GST_STATE_CHANGE_PAUSED_TO_READY:
> > > > >       gst_buffer_replace (&sink->last_buffer, NULL);
> > > > >       if (sink->window) {
> > > > >         if (gst_wl_window_is_toplevel (sink->window)) {
> > > > >           g_clear_object (&sink->window);
> > > > >         } else {
> > > > >           /* remove buffer from surface, show nothing */
> > > > >           gst_wl_window_render (sink->window, NULL, NULL);
> > > > >         }
> > > > >       }
> > > > >
> > > > > In my case, sink->window is not a toplevel, so the 'else' branch runs.
> > > > >
> > > > > gst_wl_window_render does a wl_surface_attach with a NULL buffer +
> > > > > wl_surface_commit, which should actually "hide" the window. Yet for
> > > > > some reason this is not what is happening.
> > > > >
> > > > > I am probably missing something; any ideas or hints?
> > > >
> > > > Indeed, I would expect exactly what you want to happen. Which compositor
> > > > is
> > > > this?
> > >
> > > I am using Weston in my application but I have checked and I get
> > > exactly the same behaviour with Mutter...
> >
> > Had a second thought, you said we do remove the surface on the video
> > subsurface,
> > did we forgot to do the same on the backplate subsurface ? Remember there is
> > 2
> > subsurfaces, one is a opaque black plane, that handle the bars when there is
> > padding due to pixel aspect ration adjustment. Maybe that's the problem ?
>
> Yes, exactly! I thought the video surface was being cleared to black
> but that's not what
> is happening. The video surface is being removed properly, but the
> black surface behind
> remains there.
>
> Shall I prepare a patch for this ?

Please do if you have the time, seems exactly what we should be doing.

>
> Guillermo Rodriguez Garcia
> [hidden email]
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstwaylandsink: "hide" video window when pipeline is stopped

Guillermo Rodriguez Garcia-2
Hello,

El jue., 23 ene. 2020 a las 19:19, Nicolas Dufresne
(<[hidden email]>) escribió:

>
> Le jeudi 23 janvier 2020 à 17:53 +0100, Guillermo Rodriguez Garcia a écrit :
> > Hi,
> >
> > El jue., 23 ene. 2020 a las 17:30, Nicolas Dufresne
> > (<[hidden email]>) escribió:
> > > Le jeudi 23 janvier 2020 à 11:47 +0100, Guillermo Rodriguez Garcia a écrit :
> > > > El mié., 22 ene. 2020 a las 21:47, Nicolas Dufresne
> > > > (<[hidden email]>) escribió:
> > > > > Le mercredi 22 janvier 2020 à 18:36 +0100, Guillermo Rodriguez Garcia a
> > > > > écrit :
> > > > > > Hello all,
> > > > > >
> > > > > > I am using gstwaylandsink to render to an application supplied surface
> > > > > > (via the GstVideoOverlay interface). I need to control the position of
> > > > > > the video window, so the application creates a top-level, fully
> > > > > > transparent surface with the same size as the screen, then I use
> > > > > > set_render_rectangle to tell waylandsink where the video should
> > > > > > actually be drawn. This is working fine.
> > > > > >
> > > > > > My problem is that when the pipeline is stopped (state set to NULL),
> > > > > > the video area is cleared to black, and stays on top of the
> > > > > > controlling application. I would need the video area to be "hidden"
> > > > > > instead (i.e. removed from the composition).
> > > > > >
> > > > > > The thing is that looking at the code it seems that this (hiding the
> > > > > > window) was actually the intended behaviour. Pipeline state changes
> > > > > > are handled in gst_wayland_sink_change_state [1]. For the PAUSED to
> > > > > > READY transition, the code looks like this:
> > > > > >
> > > > > >     case GST_STATE_CHANGE_PAUSED_TO_READY:
> > > > > >       gst_buffer_replace (&sink->last_buffer, NULL);
> > > > > >       if (sink->window) {
> > > > > >         if (gst_wl_window_is_toplevel (sink->window)) {
> > > > > >           g_clear_object (&sink->window);
> > > > > >         } else {
> > > > > >           /* remove buffer from surface, show nothing */
> > > > > >           gst_wl_window_render (sink->window, NULL, NULL);
> > > > > >         }
> > > > > >       }
> > > > > >
> > > > > > In my case, sink->window is not a toplevel, so the 'else' branch runs.
> > > > > >
> > > > > > gst_wl_window_render does a wl_surface_attach with a NULL buffer +
> > > > > > wl_surface_commit, which should actually "hide" the window. Yet for
> > > > > > some reason this is not what is happening.
> > > > > >
> > > > > > I am probably missing something; any ideas or hints?
> > > > >
> > > > > Indeed, I would expect exactly what you want to happen. Which compositor
> > > > > is
> > > > > this?
> > > >
> > > > I am using Weston in my application but I have checked and I get
> > > > exactly the same behaviour with Mutter...
> > >
> > > Had a second thought, you said we do remove the surface on the video
> > > subsurface,
> > > did we forgot to do the same on the backplate subsurface ? Remember there is
> > > 2
> > > subsurfaces, one is a opaque black plane, that handle the bars when there is
> > > padding due to pixel aspect ration adjustment. Maybe that's the problem ?
> >
> > Yes, exactly! I thought the video surface was being cleared to black
> > but that's not what
> > is happening. The video surface is being removed properly, but the
> > black surface behind
> > remains there.
> >
> > Shall I prepare a patch for this ?
>
> Please do if you have the time, seems exactly what we should be doing.

Just did this:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/1003

BR,

Guillermo Rodriguez Garcia
[hidden email]
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel