From 39f4fd0dc7e025af5c653e43dc05e71455d99570 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 5 Oct 2020 00:16:46 +0200 Subject: screenshot: add --screenshot-sw option Probably worthless. As usual, the manpage dumps all the subtle differences due to implementation details on the user. --- DOCS/man/options.rst | 15 +++++++++++++++ options/options.c | 1 + options/options.h | 1 + player/screenshot.c | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index fd19d3d25c..c5e8aeb5c0 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -4224,6 +4224,21 @@ Screenshot more CPU time. Note that this also affects the screenshot quality when used with lossy WebP files. The default is 4. +``--screenshot-sw=`` + Whether to use software rendering for screenshots (default: no). + + If set to no, the screenshot will be rendered by the current VO if possible + (only vo_gpu currently). The advantage is that this will (probably) always + show up as in the video window, because the same code is used for rendering. + But since the renderer needs to be reinitialized, this can be slow and + interrupt playback. (Unless the ``window`` mode is used with the + ``screenshot`` command.) + + If set to yes, the software scaler is used to convert the video to RGB (or + whatever the target screenshot requires). In this case, conversion will + run in a separate thread and will probably not interrupt playback. The + software renderer may lack some capabilities, such as HDR rendering. + Software Scaler --------------- diff --git a/options/options.c b/options/options.c index a4d3d3250d..c297200a45 100644 --- a/options/options.c +++ b/options/options.c @@ -752,6 +752,7 @@ static const m_option_t mp_opts[] = { {"screenshot-template", OPT_STRING(screenshot_template)}, {"screenshot-directory", OPT_STRING(screenshot_directory), .flags = M_OPT_FILE}, + {"screenshot-sw", OPT_BOOL(screenshot_sw)}, {"record-file", OPT_STRING(record_file), .flags = M_OPT_FILE, .deprecation_message = "use --stream-record or the dump-cache command"}, diff --git a/options/options.h b/options/options.h index 606bc6c8a2..b865ff8896 100644 --- a/options/options.h +++ b/options/options.h @@ -276,6 +276,7 @@ typedef struct MPOpts { struct image_writer_opts *screenshot_image_opts; char *screenshot_template; char *screenshot_directory; + bool screenshot_sw; int index_mode; diff --git a/player/screenshot.c b/player/screenshot.c index e731e02e21..f0af132efb 100644 --- a/player/screenshot.c +++ b/player/screenshot.c @@ -346,7 +346,8 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode, .high_bit_depth = high_depth && mpctx->opts->screenshot_image_opts->high_bit_depth, }; - vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &ctrl); + if (!mpctx->opts->screenshot_sw) + vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &ctrl); image = ctrl.res; if (image) need_add_subs = false; -- cgit v1.2.3