diff options
author | wm4 <wm4@nowhere> | 2018-05-10 15:00:27 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:34 +0200 |
commit | d7ed3ba4734654f50d577e653179c2c0d729ae30 (patch) | |
tree | 49d0d1611ddf74517e066455525a94faf8499918 | |
parent | b0a04b8dea84bb3500330bd6ed53d2054c9cc6dd (diff) | |
download | mpv-d7ed3ba4734654f50d577e653179c2c0d729ae30.tar.bz2 mpv-d7ed3ba4734654f50d577e653179c2c0d729ae30.tar.xz |
screenshot: report success to caller
Matters only to API callers, but still nice to have.
-rw-r--r-- | player/screenshot.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/player/screenshot.c b/player/screenshot.c index 622d9288b0..e654ce2081 100644 --- a/player/screenshot.c +++ b/player/screenshot.c @@ -93,7 +93,7 @@ static char *stripext(void *talloc_ctx, const char *s) return talloc_asprintf(talloc_ctx, "%.*s", (int)(end - s), s); } -static void write_screenshot(struct MPContext *mpctx, struct mp_image *img, +static bool write_screenshot(struct MPContext *mpctx, struct mp_image *img, const char *filename, struct image_writer_opts *opts) { screenshot_ctx *ctx = mpctx->screenshot_ctx; @@ -113,6 +113,7 @@ static void write_screenshot(struct MPContext *mpctx, struct mp_image *img, } else { screenshot_msg(ctx, MSGL_ERR, "Error writing screenshot!"); } + return ok; } #ifdef _WIN32 @@ -418,9 +419,10 @@ void cmd_screenshot_to_file(void *p) ctx->osd = old_osd; if (!image) { screenshot_msg(ctx, MSGL_ERR, "Taking screenshot failed."); + cmd->success = false; return; } - write_screenshot(mpctx, image, filename, &opts); + cmd->success = write_screenshot(mpctx, image, filename, &opts); talloc_free(image); } @@ -451,6 +453,8 @@ void cmd_screenshot(void *p) } } + cmd->success = false; + ctx->osd = osd; struct image_writer_opts *opts = mpctx->opts->screenshot_image_opts; @@ -461,7 +465,7 @@ void cmd_screenshot(void *p) if (image) { char *filename = gen_fname(ctx, image_writer_file_ext(opts)); if (filename) - write_screenshot(mpctx, image, filename, NULL); + cmd->success = write_screenshot(mpctx, image, filename, NULL); talloc_free(filename); } else { screenshot_msg(ctx, MSGL_ERR, "Taking screenshot failed."); |