vo_rpi: work around firmware oddness leading to incorrect video rect

Apparently, the firmware will ignore pixel_x/pixel_y if the numeric
value of them gets too high (even if they indicate square pixel aspect
ratio). Even worse, the destination rectangle is ignored completely,
and the video frame is simply stretched to the screen. I suspect this
is an overflow or weird sanity check within the firmware.

Work it around by limiting the fields to 16000, which is an arbitrary
but apparently working limit.
This commit is contained in:
wm4 2016-01-05 14:09:48 +01:00
parent 0015afd059
commit 0b5af5639b
1 changed files with 4 additions and 2 deletions

View File

@ -173,6 +173,8 @@ static void resize(struct vo *vo)
int src_w = src.x1 - src.x0, src_h = src.y1 - src.y0,
dst_w = dst.x1 - dst.x0, dst_h = dst.y1 - dst.y0;
int p_x, p_y;
av_reduce(&p_x, &p_y, dst_w * src_h, src_w * dst_h, 16000);
MMAL_DISPLAYREGION_T dr = {
.hdr = { .id = MMAL_PARAMETER_DISPLAYREGION,
.size = sizeof(MMAL_DISPLAYREGION_T), },
@ -180,8 +182,8 @@ static void resize(struct vo *vo)
.dest_rect = { .x = dst.x0, .y = dst.y0, .width = dst_w, .height = dst_h },
.layer = p->video_layer,
.display_num = p->display_nr,
.pixel_x = dst_w * src_h,
.pixel_y = src_w * dst_h,
.pixel_x = p_x,
.pixel_y = p_y,
.set = MMAL_DISPLAY_SET_SRC_RECT | MMAL_DISPLAY_SET_DEST_RECT |
MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_NUM |
MMAL_DISPLAY_SET_PIXEL,