summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-05 14:09:48 +0100
committerwm4 <wm4@nowhere>2016-01-05 14:20:47 +0100
commit0b5af5639b883356505346159aac5553fd5cdc8f (patch)
tree7b4a26785bc53125c77f64d2379349b1b8dee9f2
parent0015afd059926d966f145f4410d3f09415c83535 (diff)
downloadmpv-0b5af5639b883356505346159aac5553fd5cdc8f.tar.bz2
mpv-0b5af5639b883356505346159aac5553fd5cdc8f.tar.xz
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.
-rw-r--r--video/out/vo_rpi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/video/out/vo_rpi.c b/video/out/vo_rpi.c
index 9750bc3cf7..ea496fd5ae 100644
--- a/video/out/vo_rpi.c
+++ b/video/out/vo_rpi.c
@@ -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,