From 216e8320b02e76a407b114ca4de73763e9df3507 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 15 Jun 2013 00:15:32 +0200 Subject: 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.) --- video/out/vo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'video') 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); } -- cgit v1.2.3