diff options
author | wm4 <wm4@nowhere> | 2013-06-15 00:15:32 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-08-19 13:03:08 +0200 |
commit | 216e8320b02e76a407b114ca4de73763e9df3507 (patch) | |
tree | cf96184f0eb011d41366e23357914e385ee0cdf1 /video/out | |
parent | 67704e2977d2bb5c35f962b154d5e8e481e2d508 (diff) | |
download | mpv-216e8320b02e76a407b114ca4de73763e9df3507.tar.bz2 mpv-216e8320b02e76a407b114ca4de73763e9df3507.tar.xz |
video: make it possible to scale/pan the video by arbitrary amounts
Add --video-align-x/y, --video-pan-x/y, --video-scale options and
properties. See the additions to the manpage for description and
semantics.
These transformations are intentionally done on top of panscan. Unlike
the (now removed) --panscanrange option, this doesn't affect the default
panscan behavior. (Although panscan itself becomes kind of useless if
the new options are used.)
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/vo.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/video/out/vo.c b/video/out/vo.c index be1ba84a12..1237ae0a23 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -488,13 +488,17 @@ static void clamp_size(int size, int *start, int *end) static void src_dst_split_scaling(int src_size, int dst_size, int scaled_src_size, + float zoom, float align, float pan, int *src_start, int *src_end, int *dst_start, int *dst_end, int *osd_margin_a, int *osd_margin_b) { + scaled_src_size += zoom * src_size; + align = (align + 1) / 2; + *src_start = 0; *src_end = src_size; - *dst_start = (dst_size - scaled_src_size) / 2; + *dst_start = (dst_size - scaled_src_size) * align + pan * scaled_src_size; *dst_end = *dst_start + scaled_src_size; // Distance of screen frame to video @@ -543,9 +547,11 @@ void vo_get_src_dst_rects(struct vo *vo, struct mp_rect *out_src, int scaled_width, scaled_height; aspect_calc_panscan(vo, &scaled_width, &scaled_height); src_dst_split_scaling(src_w, vo->dwidth, scaled_width, + opts->zoom, opts->align_x, opts->pan_x, &src.x0, &src.x1, &dst.x0, &dst.x1, &osd.ml, &osd.mr); src_dst_split_scaling(src_h, vo->dheight, scaled_height, + opts->zoom, opts->align_y, opts->pan_y, &src.y0, &src.y1, &dst.y0, &dst.y1, &osd.mt, &osd.mb); } |