caopengllayer: do vertical flip after picture placement

Vertically swapping the position of the video keeps the place "height".
The vertical position use the inverted position of the bottom position
rather than the top position of the video.
This commit is contained in:
Steve Lhomme 2024-04-09 15:16:59 +02:00
parent 272514cfdd
commit 9a321d7cb7
1 changed files with 5 additions and 11 deletions

View File

@ -411,12 +411,7 @@ static int Open (vout_display_t *vd,
glsys->cgl_prev = NULL;
dispatch_sync(dispatch_get_main_queue(), ^{
// Reverse vertical alignment as the GL tex are Y inverted
sys->cfg = *vd->cfg;
if (sys->cfg.display.align.vertical == VLC_VIDEO_ALIGN_TOP)
sys->cfg.display.align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
else if (sys->cfg.display.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
sys->cfg.display.align.vertical = VLC_VIDEO_ALIGN_TOP;
// Create video view
sys->videoView = [[VLCVideoLayerView alloc] initWithVoutDisplay:vd];
@ -435,7 +430,9 @@ static int Open (vout_display_t *vd,
sys->videoLayer = nil;
}
vout_display_PlacePicture(&sys->place, vd->source, &sys->cfg.display);
vout_display_PlacePicture(&sys->place, vd->source, &vd->cfg->display);
// Reverse vertical alignment as the GL tex are Y inverted
sys->place.y = vd->cfg->display.height - (sys->place.y + sys->place.height);
});
if (sys->videoView == nil) {
@ -568,14 +565,11 @@ static int Control (vout_display_t *vd, int query)
cfg.display.width = sys->cfg.display.width;
cfg.display.height = sys->cfg.display.height;
// Reverse vertical alignment as the GL tex are Y inverted
if (cfg.display.align.vertical == VLC_VIDEO_ALIGN_TOP)
cfg.display.align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
else if (cfg.display.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
cfg.display.align.vertical = VLC_VIDEO_ALIGN_TOP;
sys->cfg = cfg;
vout_display_PlacePicture(&sys->place, vd->source, &cfg.display);
// Reverse vertical alignment as the GL tex are Y inverted
sys->place.y = cfg.display.height - (sys->place.y + sys->place.height);
}
// Note!