From 9f595f3a80eeaa0bfbda5702031f054f684f6123 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 7 Feb 2018 20:18:36 +0100 Subject: 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. --- video/out/vo.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'video/out/vo.h') diff --git a/video/out/vo.h b/video/out/vo.h index bf5995f722..4ce2cf1371 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -102,8 +102,13 @@ enum mp_voctrl { VOCTRL_GET_DISPLAY_NAMES, // Retrieve window contents. (Normal screenshots use vo_get_current_frame().) + // Deprecated for VOCTRL_SCREENSHOT with corresponding flags. VOCTRL_SCREENSHOT_WIN, // struct mp_image** + // A normal screenshot - VOs can react to this if vo_get_current_frame() is + // not sufficient. + VOCTRL_SCREENSHOT, // struct voctrl_screenshot* + VOCTRL_UPDATE_RENDER_OPTS, VOCTRL_GET_ICC_PROFILE, // bstr* @@ -170,6 +175,11 @@ struct voctrl_performance_data { struct mp_frame_perf fresh, redraw; }; +struct voctrl_screenshot { + bool scaled, subs, osd, high_bit_depth; + struct mp_image *res; +}; + enum { // VO does handle mp_image_params.rotate in 90 degree steps VO_CAP_ROTATE90 = 1 << 0, @@ -447,6 +457,7 @@ double vo_get_estimated_vsync_jitter(struct vo *vo); double vo_get_display_fps(struct vo *vo); double vo_get_delay(struct vo *vo); void vo_discard_timing_info(struct vo *vo); +struct vo_frame *vo_get_current_vo_frame(struct vo *vo); struct mp_image *vo_get_image(struct vo *vo, int imgfmt, int w, int h, int stride_align); -- cgit v1.2.3