summaryrefslogtreecommitdiffstats
path: root/screenshot.c
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2011-10-06 20:46:01 +0200
committerUoti Urpala <uau@mplayer2.org>2011-11-25 23:56:28 +0200
commit3041ee8d6c97fbccfe891edad5b57143fb1c6c2a (patch)
tree6edbd27ec73ec92432c559459d20a8303109a648 /screenshot.c
parent01cf896a2f0d8be92c6d6633095fa2719a8c0e58 (diff)
downloadmpv-3041ee8d6c97fbccfe891edad5b57143fb1c6c2a.tar.bz2
mpv-3041ee8d6c97fbccfe891edad5b57143fb1c6c2a.tar.xz
core: add screenshot mode for actual VO window contents
The screenshot command normally converts the currently displayed video frame to an image. Add support for an alternative screenshot mode that is supposed to capture the real window contents. Such a screenshot contains a possibly scaled version of the frame, the OSD, and subtitles. Add a default key binding Alt+s for taking screenshots in this mode. This needs special VO support, and might not work with all VOs (this commit does not yet contain an implementation for any VO, only the infrastructure).
Diffstat (limited to 'screenshot.c')
-rw-r--r--screenshot.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/screenshot.c b/screenshot.c
index e05bbfe480..9b8c67a89a 100644
--- a/screenshot.c
+++ b/screenshot.c
@@ -46,6 +46,7 @@
#include "libvo/csputils.h"
typedef struct screenshot_ctx {
+ int full_window;
int each_frame;
int using_vf_screenshot;
@@ -175,10 +176,11 @@ static void vf_screenshot_callback(void *pctx, struct mp_image *image)
screenshot_ctx *ctx = screenshot_get_ctx(mpctx);
screenshot_save(mpctx, image);
if (ctx->each_frame)
- screenshot_request(mpctx, 0);
+ screenshot_request(mpctx, 0, ctx->full_window);
}
-void screenshot_request(struct MPContext *mpctx, bool each_frame)
+void screenshot_request(struct MPContext *mpctx, bool each_frame,
+ bool full_window)
{
if (mpctx->video_out && mpctx->video_out->config_ok) {
screenshot_ctx *ctx = screenshot_get_ctx(mpctx);
@@ -187,11 +189,12 @@ void screenshot_request(struct MPContext *mpctx, bool each_frame)
if (each_frame) {
ctx->each_frame = !ctx->each_frame;
+ ctx->full_window = full_window;
if (!ctx->each_frame)
return;
}
- struct voctrl_screenshot_args args;
+ struct voctrl_screenshot_args args = { .full_window = full_window };
if (vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &args) == true) {
screenshot_save(mpctx, args.out_image);
free_mp_image(args.out_image);
@@ -226,5 +229,5 @@ void screenshot_flip(struct MPContext *mpctx)
if (ctx->using_vf_screenshot)
return;
- screenshot_request(mpctx, 0);
+ screenshot_request(mpctx, 0, ctx->full_window);
}