diff options
author | wm4 <wm4@nowhere> | 2012-10-26 20:19:06 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-11-01 02:07:45 +0100 |
commit | c62efc52c6c5f9dc9cf8e335f6e934e69a721331 (patch) | |
tree | f29779dd1e4624dba1e7d0824eca93a8ce9f7a4e /screenshot.c | |
parent | 738aeb1c60c6ffe95e915e443598f8a51081bdfb (diff) | |
download | mpv-c62efc52c6c5f9dc9cf8e335f6e934e69a721331.tar.bz2 mpv-c62efc52c6c5f9dc9cf8e335f6e934e69a721331.tar.xz |
screenshot: remove hack for passing anamorphic image size
With anamorphic video (display with non-1:1 PAR, e.g. DVD), the display
size was passed using the mp_image fields w/h, which was blatantly
incorrect. w/h are the normal image dimensions, while width/height are
the "uncropped" storage size (used internally by vf.c).
Add a display_w/h, and use that for the display size. Make all VOs that
can do screenshots use it.
Diffstat (limited to 'screenshot.c')
-rw-r--r-- | screenshot.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/screenshot.c b/screenshot.c index f69bba9b76..87de5c2d37 100644 --- a/screenshot.c +++ b/screenshot.c @@ -242,25 +242,23 @@ static struct mp_image *add_subs(struct MPContext *mpctx, image->imgfmt); copy_mpi(new_image, image); vf_clone_mpi_attributes(new_image, image); - new_image->w = image->w; - new_image->h = image->h; image = new_image; } + 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 dar = (double)image->w / image->h; + double dar = (double)d_w / d_h; struct mp_osd_res res = { - .w = image->width, - .h = image->height, + .w = image->w, + .h = image->h, .display_par = sar / dar, .video_par = dar / sar, }; - // It's not really clear what's the difference between w and width - struct mp_image hack = *image; - hack.w = hack.width; - hack.h = hack.height; + osd_draw_on_image(mpctx->osd, res, mpctx->osd->vo_pts, - OSD_DRAW_SUB_ONLY, &hack); + OSD_DRAW_SUB_ONLY, image); return image; } |