summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-21 19:56:25 +0100
committerwm4 <wm4@nowhere>2012-11-21 19:58:51 +0100
commit10a1ae7b720b7b116c98f78d611c92923559620e (patch)
tree99c5a5bcef4a83689ed652f94cff342117db58d9 /core
parent4b91861b6710e9f82618b58841e08986e965eb43 (diff)
downloadmpv-10a1ae7b720b7b116c98f78d611c92923559620e.tar.bz2
mpv-10a1ae7b720b7b116c98f78d611c92923559620e.tar.xz
screenshot: add subs even with vf_screenshot
Until now, screenshots with the video filter didn't add subs (unclear whether that was an oversight or feature). Fix this and make behavior when taking screenshots with vf_screenshot more consistent with VO screenshots. The change in vf_screenshot is needed, because add_subs() checks this flag to decide whether it's allowed to mutate the image. This commit has another user visible side effect. When taking a screenshot each frame (using the "each-frame" mode of the screenshot command), a normal screenshot command will stop the each-frame mode.
Diffstat (limited to 'core')
-rw-r--r--core/screenshot.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/core/screenshot.c b/core/screenshot.c
index 09f1aa7ee6..8e16771289 100644
--- a/core/screenshot.c
+++ b/core/screenshot.c
@@ -290,9 +290,11 @@ static void vf_screenshot_callback(void *pctx, struct mp_image *image)
{
struct MPContext *mpctx = (struct MPContext *)pctx;
screenshot_ctx *ctx = mpctx->screenshot_ctx;
- screenshot_save(mpctx, image, ctx->mode);
- if (ctx->each_frame)
- screenshot_request(mpctx, ctx->mode, false);
+ screenshot_save(mpctx, image, ctx->mode == MODE_SUBTITLES);
+ if (ctx->each_frame) {
+ ctx->each_frame = false;
+ screenshot_request(mpctx, ctx->mode, true);
+ }
}
static bool force_vf(struct MPContext *mpctx)
@@ -320,11 +322,14 @@ void screenshot_request(struct MPContext *mpctx, int mode, bool each_frame)
if (each_frame) {
ctx->each_frame = !ctx->each_frame;
- ctx->mode = mode;
if (!ctx->each_frame)
return;
+ } else {
+ ctx->each_frame = false;
}
+ ctx->mode = mode;
+
struct voctrl_screenshot_args args =
{ .full_window = (mode == MODE_FULL_WINDOW) };
if (!force_vf(mpctx)
@@ -365,5 +370,6 @@ void screenshot_flip(struct MPContext *mpctx)
if (ctx->using_vf_screenshot)
return;
- screenshot_request(mpctx, ctx->mode, false);
+ ctx->each_frame = false;
+ screenshot_request(mpctx, ctx->mode, true);
}