mirror of https://github.com/mpv-player/mpv
screenshots: add --screenshot-directory option
The plan is to use this to change the screenshot default location in pseudo-gui mode.
This commit is contained in:
parent
94a3a76ee3
commit
60958ddf9b
|
@ -2656,6 +2656,17 @@ Screenshot
|
||||||
``%%``
|
``%%``
|
||||||
Replaced with the ``%`` character itself.
|
Replaced with the ``%`` character itself.
|
||||||
|
|
||||||
|
``--screenshot-directory=<path>``
|
||||||
|
Store screenshots in this directory. This path is joined with the filename
|
||||||
|
generated by ``--screenshot-template``. If the template filename is already
|
||||||
|
absolute, the directory is ignored.
|
||||||
|
|
||||||
|
If the directory does not exist or is not a directory, an error is
|
||||||
|
generated.
|
||||||
|
|
||||||
|
This option is not set by default, and thus will write screenshots to the
|
||||||
|
directory from which mpv was started.
|
||||||
|
|
||||||
``--screenshot-jpeg-quality=<0-100>``
|
``--screenshot-jpeg-quality=<0-100>``
|
||||||
Set the JPEG quality level. Higher means better quality. The default is 90.
|
Set the JPEG quality level. Higher means better quality. The default is 90.
|
||||||
|
|
||||||
|
|
|
@ -543,6 +543,7 @@ const m_option_t mp_opts[] = {
|
||||||
|
|
||||||
OPT_SUBSTRUCT("screenshot", screenshot_image_opts, image_writer_conf, 0),
|
OPT_SUBSTRUCT("screenshot", screenshot_image_opts, image_writer_conf, 0),
|
||||||
OPT_STRING("screenshot-template", screenshot_template, 0),
|
OPT_STRING("screenshot-template", screenshot_template, 0),
|
||||||
|
OPT_STRING("screenshot-directory", screenshot_direcrory, 0),
|
||||||
|
|
||||||
OPT_SUBSTRUCT("input", input_opts, input_config, 0),
|
OPT_SUBSTRUCT("input", input_opts, input_config, 0),
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,7 @@ typedef struct MPOpts {
|
||||||
|
|
||||||
struct image_writer_opts *screenshot_image_opts;
|
struct image_writer_opts *screenshot_image_opts;
|
||||||
char *screenshot_template;
|
char *screenshot_template;
|
||||||
|
char *screenshot_direcrory;
|
||||||
|
|
||||||
double force_fps;
|
double force_fps;
|
||||||
int index_mode;
|
int index_mode;
|
||||||
|
|
|
@ -280,6 +280,14 @@ static char *gen_fname(screenshot_ctx *ctx, const char *file_ext)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *dir = ctx->mpctx->opts->screenshot_direcrory;
|
||||||
|
if (dir && dir[0]) {
|
||||||
|
void *t = fname;
|
||||||
|
dir = mp_get_user_path(t, ctx->mpctx->global, dir);
|
||||||
|
fname = mp_path_join(NULL, bstr0(dir), bstr0(fname));
|
||||||
|
talloc_free(t);
|
||||||
|
}
|
||||||
|
|
||||||
if (!mp_path_exists(fname))
|
if (!mp_path_exists(fname))
|
||||||
return fname;
|
return fname;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue