summaryrefslogtreecommitdiffstats
path: root/player/screenshot.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/screenshot.c')
-rw-r--r--player/screenshot.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/player/screenshot.c b/player/screenshot.c
index af06701bbb..eccce16dd6 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -83,7 +83,8 @@ 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->log);
+ bool ok = img && write_image(img, &opts_copy, filename, mpctx->global,
+ mpctx->log);
mp_core_lock(mpctx);
@@ -370,7 +371,7 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode,
}
struct mp_image *convert_image(struct mp_image *image, int destfmt,
- struct mp_log *log)
+ struct mpv_global *global, struct mp_log *log)
{
int d_w, d_h;
mp_image_params_get_dsize(&image->params, &d_w, &d_h);
@@ -396,7 +397,14 @@ struct mp_image *convert_image(struct mp_image *image, int destfmt,
dst->params = p;
- if (mp_image_swscale(dst, image, mp_sws_hq_flags) < 0) {
+ struct mp_sws_context *sws = mp_sws_alloc(NULL);
+ sws->log = log;
+ if (global)
+ mp_sws_enable_cmdline_opts(sws, global);
+ bool ok = mp_sws_scale(sws, dst, image) >= 0;
+ talloc_free(sws);
+
+ if (!ok) {
mp_err(log, "Error when converting image.\n");
talloc_free(dst);
return NULL;
@@ -411,7 +419,8 @@ static struct mp_image *screenshot_get_rgb(struct MPContext *mpctx, int mode)
struct mp_image *mpi = screenshot_get(mpctx, mode, false);
if (!mpi)
return NULL;
- struct mp_image *res = convert_image(mpi, IMGFMT_BGR0, mpctx->log);
+ struct mp_image *res = convert_image(mpi, IMGFMT_BGR0, mpctx->global,
+ mpctx->log);
talloc_free(mpi);
return res;
}