From 4b91861b6710e9f82618b58841e08986e965eb43 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 21 Nov 2012 19:40:33 +0100 Subject: video: fix bogus uses of mp_image.w/width mp_image has this confusing distinction between the w/h and width/height fields. w/h are the actual width and height, while width/height have a very special meaning inside the video filter code: it's the actually allocated width, which is also used for stride padding. Screenshot related code abused the w/h fields to store the aspect corrected size. Some code confused the role of w/h and width/height. Fix these issues. For aspect corrected size, display_w/h are used, while width/height should never be used outside vf.c internals and related code. This also fixes an actual bug when taking screenshots of anamorphic video with vf_screenshot, as well as using vo_image with such videos. --- core/screenshot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/screenshot.c b/core/screenshot.c index e2d237010c..09f1aa7ee6 100644 --- a/core/screenshot.c +++ b/core/screenshot.c @@ -238,7 +238,7 @@ static struct mp_image *add_subs(struct MPContext *mpctx, struct mp_image *image) { if (!(image->flags & MP_IMGFLAG_ALLOCATED)) { - struct mp_image *new_image = alloc_mpi(image->width, image->height, + struct mp_image *new_image = alloc_mpi(image->w, image->h, image->imgfmt); copy_mpi(new_image, image); vf_clone_mpi_attributes(new_image, image); @@ -248,7 +248,7 @@ static struct mp_image *add_subs(struct MPContext *mpctx, int d_w = image->display_w ? image->display_w : image->w; int d_h = image->display_h ? image->display_h : image->h; - double sar = (double)image->width / image->height; + double sar = (double)image->w / image->h; double dar = (double)d_w / d_h; struct mp_osd_res res = { .w = image->w, -- cgit v1.2.3