summaryrefslogtreecommitdiffstats
path: root/video/out/gpu/video.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-02-07 20:18:36 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-11 17:45:51 -0800
commit9f595f3a80eeaa0bfbda5702031f054f684f6123 (patch)
tree0667e6e7ab4c64dcfd28aa23e10690e1776a6f03 /video/out/gpu/video.h
parent7b1e73139f73f446a472782e1465040c0e6b16dd (diff)
downloadmpv-9f595f3a80eeaa0bfbda5702031f054f684f6123.tar.bz2
mpv-9f595f3a80eeaa0bfbda5702031f054f684f6123.tar.xz
vo_gpu: make screenshots use the GL renderer
Using the GL renderer for color conversion will make sure screenshots will use the same conversion as normal video rendering. It can do this for all types of screenshots. The logic when to write 16 bit PNGs changes. To approximate the old behavior, we decide by looking whether the source video format has more than 8 bits per component. We apply this logic even for window screenshots. Also, 16 bit PNGs now always include an unused alpha channel. The reason is that FFmpeg has RGB48 and RGBA64 formats, but no RGB064. RGB48 is 3 bytes and usually not supported by GPUs for rendering, so we have to use RGBA64, which forces an alpha channel. Will break for users who use --target-trc and similar options. I considered creating a new gl_video context, but it could double GPU memory use, so I didn't. This uses FBOs instead of glGetTexImage(), because that increases the chance it could work on GLES (e.g. ANGLE). Untested. No support for the Vulkan and D3D11 backends yet. Fixes #5498. Also fixes #5240, because the code for reading back is not used with the new code path.
Diffstat (limited to 'video/out/gpu/video.h')
-rw-r--r--video/out/gpu/video.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h
index cd17308810..80f31c2934 100644
--- a/video/out/gpu/video.h
+++ b/video/out/gpu/video.h
@@ -146,6 +146,7 @@ extern const struct m_sub_options gl_video_conf;
struct gl_video;
struct vo_frame;
+struct voctrl_screenshot;
enum {
RENDER_FRAME_SUBS = 1 << 0,
@@ -172,6 +173,9 @@ void gl_video_set_osd_pts(struct gl_video *p, double pts);
bool gl_video_check_osd_change(struct gl_video *p, struct mp_osd_res *osd,
double pts);
+void gl_video_screenshot(struct gl_video *p, struct vo_frame *frame,
+ struct voctrl_screenshot *args);
+
float gl_video_scale_ambient_lux(float lmin, float lmax,
float rmin, float rmax, float lux);
void gl_video_set_ambient_lux(struct gl_video *p, int lux);