diff options
author | wm4 <wm4@nowhere> | 2015-01-23 22:06:12 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-23 22:08:20 +0100 |
commit | 5e9f7916674c4640707727eac80c659290492bad (patch) | |
tree | 5a87d5893508384dcfaa11a35690b94b89d16e86 /player/screenshot.c | |
parent | 4a1a0e98d8f7ce8e1ab61ff740699cce9bb43f70 (diff) | |
download | mpv-5e9f7916674c4640707727eac80c659290492bad.tar.bz2 mpv-5e9f7916674c4640707727eac80c659290492bad.tar.xz |
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.)
Diffstat (limited to 'player/screenshot.c')
-rw-r--r-- | player/screenshot.c | 49 |
1 files changed, 25 insertions, 24 deletions
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; } |