diff options
author | wm4 <wm4@mplayer2.org> | 2012-01-17 03:50:08 +0100 |
---|---|---|
committer | wm4 <wm4@mplayer2.org> | 2012-02-29 03:41:14 +0100 |
commit | 8b69d8a366df590c2160b36269dae424f93eabb7 (patch) | |
tree | 584dceea98ff8bb34cf98a279f510d0334edf9cb /screenshot.c | |
parent | 5fcd29eb4010835d2879304e7a404d575206fcbf (diff) | |
download | mpv-8b69d8a366df590c2160b36269dae424f93eabb7.tar.bz2 mpv-8b69d8a366df590c2160b36269dae424f93eabb7.tar.xz |
screenshot: allow forcing taking screenshots with the video filter
If the screenshot_force video filter is inserted, taking screenshots will
always use the video filter, and skip the VO specific screenshot code.
This can be useful if the VO code causes problems, or if it's intended to
take screenshots from a specific location in the filter chain.
The 'screenshot' filter is intended as fallback, it's not used if possible.
Diffstat (limited to 'screenshot.c')
-rw-r--r-- | screenshot.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/screenshot.c b/screenshot.c index 693aba4a9f..614f1f55ae 100644 --- a/screenshot.c +++ b/screenshot.c @@ -282,6 +282,19 @@ static void vf_screenshot_callback(void *pctx, struct mp_image *image) screenshot_request(mpctx, 0, ctx->full_window); } +static bool force_vf(struct MPContext *mpctx) +{ + if (mpctx->sh_video) { + struct vf_instance *vf = mpctx->sh_video->vfilter; + while (vf) { + if (strcmp(vf->info->name, "screenshot_force") == 0) + return true; + vf = vf->next; + } + } + return false; +} + void screenshot_request(struct MPContext *mpctx, bool each_frame, bool full_window) { @@ -298,7 +311,9 @@ void screenshot_request(struct MPContext *mpctx, bool each_frame, } struct voctrl_screenshot_args args = { .full_window = full_window }; - if (vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &args) == true) { + if (!force_vf(mpctx) + && vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &args) == true) + { screenshot_save(mpctx, args.out_image); free_mp_image(args.out_image); } else { |