screenshot: add --screenshot-sw option

Probably worthless. As usual, the manpage dumps all the subtle
differences due to implementation details on the user.
This commit is contained in:
wm4 2020-10-05 00:16:46 +02:00
parent 34b8adc456
commit 39f4fd0dc7
4 changed files with 19 additions and 1 deletions

View File

@ -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=<yes|no>``
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
---------------

View File

@ -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"},

View File

@ -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;

View File

@ -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;