summaryrefslogtreecommitdiffstats
path: root/video/out/vo_rpi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-05 14:34:45 +0100
committerwm4 <wm4@nowhere>2016-01-05 14:48:27 +0100
commit481d15ae6066f3602411aa09cc43e52fbb1b0b64 (patch)
tree880c43b3b1287cfd692b0e1da74fd49848f5719a /video/out/vo_rpi.c
parent0b5af5639b883356505346159aac5553fd5cdc8f (diff)
downloadmpv-481d15ae6066f3602411aa09cc43e52fbb1b0b64.tar.bz2
mpv-481d15ae6066f3602411aa09cc43e52fbb1b0b64.tar.xz
vo_rpi: handle rotation
Since the MMAL video renderer component supports exactly what we need, it's pretty simple.
Diffstat (limited to 'video/out/vo_rpi.c')
-rw-r--r--video/out/vo_rpi.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/video/out/vo_rpi.c b/video/out/vo_rpi.c
index ea496fd5ae..9548f3a13f 100644
--- a/video/out/vo_rpi.c
+++ b/video/out/vo_rpi.c
@@ -171,6 +171,12 @@ static void resize(struct vo *vo)
vo_get_src_dst_rects(vo, &src, &dst, &p->osd_res);
+ int rotate[] = {MMAL_DISPLAY_ROT0,
+ MMAL_DISPLAY_ROT90,
+ MMAL_DISPLAY_ROT180,
+ MMAL_DISPLAY_ROT270};
+
+
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;
@@ -184,11 +190,17 @@ static void resize(struct vo *vo)
.display_num = p->display_nr,
.pixel_x = p_x,
.pixel_y = p_y,
+ .transform = rotate[vo->params ? vo->params->rotate / 90 : 0],
.set = MMAL_DISPLAY_SET_SRC_RECT | MMAL_DISPLAY_SET_DEST_RECT |
MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_NUM |
- MMAL_DISPLAY_SET_PIXEL,
+ MMAL_DISPLAY_SET_PIXEL | MMAL_DISPLAY_SET_TRANSFORM,
};
+ if (vo->params && (vo->params->rotate % 180) == 90) {
+ MPSWAP(int, dr.src_rect.x, dr.src_rect.y);
+ MPSWAP(int, dr.src_rect.width, dr.src_rect.height);
+ }
+
if (mmal_port_parameter_set(input, &dr.hdr))
MP_WARN(vo, "could not set video rectangle\n");
}
@@ -677,6 +689,7 @@ static const struct m_option options[] = {
const struct vo_driver video_out_rpi = {
.description = "Raspberry Pi (MMAL)",
.name = "rpi",
+ .caps = VO_CAP_ROTATE90,
.preinit = preinit,
.query_format = query_format,
.reconfig = reconfig,