From 5e9f7916674c4640707727eac80c659290492bad Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 23 Jan 2015 22:06:12 +0100 Subject: video: separate screenshot modes Use different VOCTRLs for "window" and normal screenshot modes. The normal one will probably be removed, and replaced by generic code in vo.c, and this commit is preparation for this. (Doing it the other way around would be slightly simpler, but I haven't decided yet about the second one, and touching every VO is needed anyway in order to remove the unneeded crap. E.g. has_osd has been unused for a long time.) --- player/screenshot.c | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'player') diff --git a/player/screenshot.c b/player/screenshot.c index 7d1c743e40..2a1aaf6746 100644 --- a/player/screenshot.c +++ b/player/screenshot.c @@ -326,37 +326,38 @@ static void screenshot_save(struct MPContext *mpctx, struct mp_image *image) static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode) { struct mp_image *image = NULL; - if (mpctx->video_out && mpctx->video_out->config_ok) { - if (mode == MODE_SUBTITLES && osd_get_render_subs_in_filter(mpctx->osd)) - mode = 0; + if (mode == MODE_SUBTITLES && osd_get_render_subs_in_filter(mpctx->osd)) + mode = 0; - struct voctrl_screenshot_args args = - { .full_window = (mode == MODE_FULL_WINDOW) }; + // vf_screenshot + if (mpctx->d_video && mpctx->d_video->vfilter) + vf_control_any(mpctx->d_video->vfilter, VFCTRL_SCREENSHOT, &image); - if (mpctx->d_video && mpctx->d_video->vfilter) - vf_control_any(mpctx->d_video->vfilter, VFCTRL_SCREENSHOT, &args); + if (!image && mpctx->video_out && mpctx->video_out->config_ok) { + vo_wait_frame(mpctx->video_out); // important for each-frame mode - if (!args.out_image) { - vo_wait_frame(mpctx->video_out); // important for each-frame mode - vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &args); + if (mode != MODE_FULL_WINDOW) + vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &image); + if (!image) { + vo_control(mpctx->video_out, VOCTRL_SCREENSHOT_WIN, &image); + mode = MODE_FULL_WINDOW; } + } - image = args.out_image; - if (image) { - if (mpctx->d_video && mpctx->d_video->hwdec_info) { - struct mp_hwdec_ctx *ctx = mpctx->d_video->hwdec_info->hwctx; - struct mp_image *nimage = NULL; - if (ctx && ctx->download_image) - nimage = ctx->download_image(ctx, image, NULL); - if (nimage) { - talloc_free(image); - image = nimage; - } - } - if (mode == MODE_SUBTITLES && !args.has_osd) - add_subs(mpctx, image); + if (image && mpctx->d_video && mpctx->d_video->hwdec_info) { + struct mp_hwdec_ctx *ctx = mpctx->d_video->hwdec_info->hwctx; + struct mp_image *nimage = NULL; + if (ctx && ctx->download_image) + nimage = ctx->download_image(ctx, image, NULL); + if (nimage) { + talloc_free(image); + image = nimage; } } + + if (image && mode == MODE_SUBTITLES) + add_subs(mpctx, image); + return image; } -- cgit v1.2.3