From 60e8a3d404f0640fa5a3f834eae54b4f1fb9127d Mon Sep 17 00:00:00 2001 From: Daniel Baumann <daniel.baumann@progress-linux.org> Date: Sat, 4 May 2024 03:13:14 +0200 Subject: Adding upstream version 0.38.0. Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org> --- player/screenshot.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'player/screenshot.c') diff --git a/player/screenshot.c b/player/screenshot.c index e4d0912..aa637e6 100644 --- a/player/screenshot.c +++ b/player/screenshot.c @@ -77,7 +77,8 @@ static char *stripext(void *talloc_ctx, const char *s) } static bool write_screenshot(struct mp_cmd_ctx *cmd, struct mp_image *img, - const char *filename, struct image_writer_opts *opts) + const char *filename, struct image_writer_opts *opts, + bool overwrite) { struct MPContext *mpctx = cmd->mpctx; struct image_writer_opts *gopts = mpctx->opts->screenshot_image_opts; @@ -88,7 +89,7 @@ static bool write_screenshot(struct mp_cmd_ctx *cmd, struct mp_image *img, mp_core_unlock(mpctx); bool ok = img && write_image(img, &opts_copy, filename, mpctx->global, - mpctx->screenshot_ctx->log); + mpctx->screenshot_ctx->log, overwrite); mp_core_lock(mpctx); @@ -166,7 +167,7 @@ static char *create_fname(struct MPContext *mpctx, char *template, goto error_exit; char fmtstr[] = {'%', '0', digits, 'd', '\0'}; res = talloc_asprintf_append(res, fmtstr, *frameno); - if (*frameno < 100000 - 1) { + if (*frameno < INT_MAX - 1) { (*frameno) += 1; (*sequence) += 1; } @@ -496,7 +497,7 @@ void cmd_screenshot_to_file(void *p) cmd->success = false; return; } - cmd->success = write_screenshot(cmd, image, filename, &opts); + cmd->success = write_screenshot(cmd, image, filename, &opts, true); talloc_free(image); } @@ -537,7 +538,7 @@ void cmd_screenshot(void *p) if (image) { char *filename = gen_fname(cmd, image_writer_file_ext(opts)); if (filename) { - cmd->success = write_screenshot(cmd, image, filename, NULL); + cmd->success = write_screenshot(cmd, image, filename, NULL, false); if (cmd->success) { node_init(res, MPV_FORMAT_NODE_MAP, NULL); node_map_add_string(res, "filename", filename); -- cgit v1.2.3