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 /image_writer.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 'image_writer.c')
-rw-r--r-- | image_writer.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/image_writer.c b/image_writer.c index f449b5c617..2ac2c223a1 100644 --- a/image_writer.c +++ b/image_writer.c @@ -264,7 +264,9 @@ int write_image(struct mp_image *image, const struct image_writer_opts *opts, { struct mp_image *allocated_image = NULL; struct image_writer_opts defs = image_writer_opts_defaults; - bool is_anamorphic = image->w != image->width || image->h != image->height; + int d_w = image->display_w ? image->display_w : image->w; + int d_h = image->display_h ? image->display_h : image->h; + bool is_anamorphic = image->w != d_w || image->h != d_h; if (!opts) opts = &defs; @@ -287,17 +289,13 @@ int write_image(struct mp_image *image, const struct image_writer_opts *opts, // - RGB->YUV assumes BT.601 // - color levels broken in various ways thanks to libswscale if (image->imgfmt != destfmt || is_anamorphic) { - struct mp_image hack = *image; - hack.w = hack.width; - hack.h = hack.height; - - struct mp_image *dst = alloc_mpi(image->w, image->h, destfmt); + struct mp_image *dst = alloc_mpi(d_w, d_h, destfmt); vf_clone_mpi_attributes(dst, image); int flags = SWS_LANCZOS | SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP | SWS_ACCURATE_RND | SWS_BITEXACT; - mp_image_swscale(dst, &hack, flags); + mp_image_swscale(dst, image, flags); allocated_image = dst; image = dst; |