[vlc-devel] [PATCH v3 02/20] opengl: flip the vertical placement when using the placed picture area

Steve Lhomme robux4 at ycbcr.xyz
Wed Aug 26 14:03:15 CEST 2020


> diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
> index 15d0c305772..18c21534454 100644
> --- a/modules/video_output/macosx.m
> +++ b/modules/video_output/macosx.m
> @@ -322,8 +322,8 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic)
>           if (@available(macOS 10.14, *)) {
>               vout_display_place_t place;
>               vout_display_PlacePicture(&place, &vd->source, &sys->cfg);
> -            vout_display_opengl_Viewport(vd->sys->vgl, place.x,
> -                                         sys->cfg.display.height - (place.y + place.height),
> +            vout_display_PlaceFlipVertical(&sys->cfg, &place);
> +            vout_display_opengl_Viewport(vd->sys->vgl, place.x, place.y,
>                                            place.width, place.height);
>           }
>   
> @@ -355,16 +355,9 @@ static int Control (vout_display_t *vd, int query, va_list ap)
>   
>                   /* we always use our current frame here, because we have some size constraints
>                    in the ui vout provider */
> -                vout_display_cfg_t cfg_tmp = *cfg;
> -
> -                /* Reverse vertical alignment as the GL tex are Y inverted */
> -                if (cfg_tmp.align.vertical == VLC_VIDEO_ALIGN_TOP)
> -                    cfg_tmp.align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
> -                else if (cfg_tmp.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
> -                    cfg_tmp.align.vertical = VLC_VIDEO_ALIGN_TOP;
> -
>                   vout_display_place_t place;
> -                vout_display_PlacePicture(&place, &vd->source, &cfg_tmp);
> +                vout_display_PlacePicture(&place, &vd->source, cfg);
> +                vout_display_PlaceFlipVertical(cfg, &place);
>                   @synchronized (sys->glView) {
>                       sys->cfg = *cfg;
>                   }
> @@ -378,7 +371,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
>                   if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
>                       // x / y are top left corner, but we need the lower left one
>                       vout_display_opengl_Viewport(sys->vgl, place.x,
> -                                                 cfg_tmp.display.height - (place.y + place.height),
> +                                                 cfg->display.height - (place.y + place.height),

As you can see, a similar flip is used here. Reverting the flip that is 
done just before and thus useless. This patch doesn't change the current 
behavior, but there's something wrong going on.

>                                                    place.width, place.height);
>                   vlc_gl_ReleaseCurrent (sys->gl);
>   
> @@ -628,6 +621,7 @@ static void OpenglSwap (vlc_gl_t *gl)
>               sys->cfg.display.height = bounds.size.height;
>   
>               vout_display_PlacePicture(&place, &vd->source, &sys->cfg);
> +            vout_display_PlaceFlipVertical(&sys->cfg, &place);
>               // FIXME: this call leads to a fatal mutex locking error in vout_ChangeDisplaySize()
>               // vout_window_ReportSize(sys->embed, bounds.size.width, bounds.size.height);
>           }

Another unchanged behavior but I guess it has to do with the fact that 
the bounds.size changes is not reported to the core correctly.


More information about the vlc-devel mailing list