summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/tech/slave.txt11
-rw-r--r--command.c2
-rw-r--r--input/input.c4
-rw-r--r--libvo/video_out.h7
-rw-r--r--screenshot.c11
-rw-r--r--screenshot.h8
6 files changed, 32 insertions, 11 deletions
diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt
index 3b249f75d1..6bb1dc53c4 100644
--- a/DOCS/tech/slave.txt
+++ b/DOCS/tech/slave.txt
@@ -177,10 +177,17 @@ get_video_codec
get_video_resolution
Print out the video resolution of the current file.
-screenshot <value>
+screenshot <each_frame> <full_window>
Take a screenshot. Requires the screenshot filter to be loaded.
- 0 Take a single screenshot.
+ each_frame:
+ 0 Take a single screenshot. (Default.)
1 Start/stop taking screenshot of each frame.
+ full_window:
+ 0 Save the video image, in its original resolution. Typically without
+ OSD or subtitles. (Default.)
+ 1 Save the contents of the mplayer window. Typically with OSD and
+ subtitles. If not available (no VO support), this may act as if 0 was
+ passed.
key_down_event <value>
Inject <value> key code event into MPlayer.
diff --git a/command.c b/command.c
index 3b77deaa9e..71370e7033 100644
--- a/command.c
+++ b/command.c
@@ -3381,7 +3381,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
break;
case MP_CMD_SCREENSHOT:
- screenshot_request(mpctx, cmd->args[0].v.i);
+ screenshot_request(mpctx, cmd->args[0].v.i, cmd->args[1].v.i);
break;
case MP_CMD_VF_CHANGE_RECTANGLE:
diff --git a/input/input.c b/input/input.c
index 7c02be5fa9..e1c001077a 100644
--- a/input/input.c
+++ b/input/input.c
@@ -176,7 +176,7 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_VO_ONTOP, "vo_ontop", 0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
{ MP_CMD_VO_ROOTWIN, "vo_rootwin", 0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
{ MP_CMD_VO_BORDER, "vo_border", 0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
- { MP_CMD_SCREENSHOT, "screenshot", 0, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+ { MP_CMD_SCREENSHOT, "screenshot", 0, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_PANSCAN, "panscan",1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_SWITCH_VSYNC, "switch_vsync", 0, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_LOADFILE, "loadfile", 1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
@@ -507,6 +507,8 @@ static const struct cmd_bind def_cmd_binds[] = {
{ { 'C', 0 }, "step_property_osd capturing" },
{ { 's', 0 }, "screenshot 0" },
{ { 'S', 0 }, "screenshot 1" },
+ { { KEY_MODIFIER_ALT + 's', 0 }, "screenshot 0 1" },
+ { { KEY_MODIFIER_ALT + 'S', 0 }, "screenshot 1 1" },
{ { 'w', 0 }, "panscan -0.1" },
{ { 'e', 0 }, "panscan +0.1" },
diff --git a/libvo/video_out.h b/libvo/video_out.h
index fd61d9c1a1..bd7b2e8fa5 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -108,6 +108,13 @@ typedef struct mp_eosd_res {
// VOCTRL_SCREENSHOT
struct voctrl_screenshot_args {
+ // 0: Save image of the currently displayed video frame, in original
+ // resolution.
+ // 1: Save full screenshot of the window. Should contain OSD, EOSD, and the
+ // scaled video.
+ // The value of this variable can be ignored if only a single method is
+ // implemented.
+ int full_window;
// Will be set to a newly allocated image, that contains the screenshot.
// The caller has to free the pointer with free_mp_image().
// It is not specified whether the image data is a copy or references the
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);
}
diff --git a/screenshot.h b/screenshot.h
index 207d58e003..c57778c0b3 100644
--- a/screenshot.h
+++ b/screenshot.h
@@ -25,9 +25,11 @@ struct MPContext;
struct mp_image;
// Request a taking & saving a screenshot of the currently displayed frame.
-// If each_frame is set, this toggles per-frame screenshots, exactly like the
-// screenshot slave command (MP_CMD_SCREENSHOT).
-void screenshot_request(struct MPContext *mpctx, bool each_frame);
+// each_frame: If set, this toggles per-frame screenshots, exactly like the
+// screenshot slave command (MP_CMD_SCREENSHOT).
+// full_window: If set, save the actual output window contents.
+void screenshot_request(struct MPContext *mpctx, bool each_frame,
+ bool full_window);
// Save the screenshot contained in the image to disk.
// The image can be in any format supported by libswscale.