summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-01 03:27:03 +0200
committerwm4 <wm4@nowhere>2013-09-01 03:46:28 +0200
commit4d62b90f88aaed64775fdf6f0866e5ee5b3f9328 (patch)
tree4e95407bfca2d27dcdbf5b2327e2dd854cf082ee /video
parentf5144077acedc5972e475412902876242ea27c23 (diff)
downloadmpv-4d62b90f88aaed64775fdf6f0866e5ee5b3f9328.tar.bz2
mpv-4d62b90f88aaed64775fdf6f0866e5ee5b3f9328.tar.xz
video: add unscaled mode with --video-unscaled
Diffstat (limited to 'video')
-rw-r--r--video/out/vo.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index d134163141..aa027fc349 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -490,12 +490,15 @@ static void clamp_size(int size, int *start, int *end)
#define VID_SRC_ROUND_UP(x) (((x) + 1) & ~1)
static void src_dst_split_scaling(int src_size, int dst_size,
- int scaled_src_size,
+ int scaled_src_size, bool unscaled,
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)
{
+ if (unscaled)
+ scaled_src_size = src_size;
+
scaled_src_size += zoom * src_size;
align = (align + 1) / 2;
@@ -522,6 +525,17 @@ static void src_dst_split_scaling(int src_size, int dst_size,
*dst_end = dst_size;
}
+ if (unscaled && zoom == 1.0) {
+ // Force unscaled by reducing the range for src or dst
+ int src_s = *src_end - *src_start;
+ int dst_s = *dst_end - *dst_start;
+ if (src_s > dst_s) {
+ *src_end = *src_start + dst_s;
+ } else if (src_s < dst_s) {
+ *dst_end = *dst_start + src_s;
+ }
+ }
+
// For sanity: avoid bothering VOs with corner cases
clamp_size(src_size, src_start, src_end);
clamp_size(dst_size, dst_start, dst_end);
@@ -549,11 +563,11 @@ void vo_get_src_dst_rects(struct vo *vo, struct mp_rect *out_src,
if (opts->keepaspect) {
int scaled_width, scaled_height;
aspect_calc_panscan(vo, &scaled_width, &scaled_height);
- src_dst_split_scaling(src_w, vo->dwidth, scaled_width,
+ src_dst_split_scaling(src_w, vo->dwidth, scaled_width, opts->unscaled,
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,
+ src_dst_split_scaling(src_h, vo->dheight, scaled_height, opts->unscaled,
opts->zoom, opts->align_y, opts->pan_y,
&src.y0, &src.y1, &dst.y0, &dst.y1,
&osd.mt, &osd.mb);