summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-09-15 13:27:59 +0000
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-09-15 13:27:59 +0000
commit21faec3791f543a2ef23a92d57ddadf5519e5723 (patch)
tree6ed954c917b84459f7940037c163093b38b53df3
parentb32aa254f96c5f07d61b2464610bb1a5948bd897 (diff)
downloadmpv-21faec3791f543a2ef23a92d57ddadf5519e5723.tar.bz2
mpv-21faec3791f543a2ef23a92d57ddadf5519e5723.tar.xz
Add repeated screenshot mode to vf_screenshot.
It is triggered by "screenshot 1". git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19839 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--DOCS/man/en/mplayer.17
-rw-r--r--DOCS/tech/slave.txt4
-rw-r--r--input/input.c5
-rw-r--r--libmpcodecs/vf_screenshot.c21
-rw-r--r--mplayer.c2
5 files changed, 31 insertions, 8 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 4e8ba9efeb..0ac32d7dc2 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -321,6 +321,8 @@ Move subtitles up/down.
Set start or end of an EDL skip and write it out to the given file.
.IPs "s (\-vf screenshot only)"
Take a screenshot.
+.IPs "S (\-vf screenshot only)"
+Start/stop taking screenshots.
.IPs "I"
Show filename on the OSD.
.IPs "! and @"
@@ -6482,8 +6484,9 @@ decimation (ugly).
.
.TP
.B screenshot
-Allows acquiring screenshots of the movie using the screenshot command
-(bound to the 's' key by default).
+Allows acquiring screenshots of the movie using the "screenshot 0" command
+(bound to the 's' key by default). "screenshot 1" ('S' key) starts/stops
+taking screenshots with each frame.
Files named 'shotNNNN.png' will be saved in the working directory,
using the first available number - no files will be overwritten.
The filter has no overhead when not used and accepts an arbitrary
diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt
index ccd254c547..6d3199e869 100644
--- a/DOCS/tech/slave.txt
+++ b/DOCS/tech/slave.txt
@@ -142,8 +142,10 @@ get_video_resolution
grab_frames
Currently unimplemented.
-screenshot
+screenshot <value>
Take a screenshot. Requires the screenshot filter to be loaded.
+ 0 take a single screenshot
+ 1 start/stop taking screenshots with each frame
gui_[about|loadfile|loadsubtitle|play|playlist|preferences|skinbrowser|stop]
GUI actions
diff --git a/input/input.c b/input/input.c
index 79e211705e..5fe3c96eb0 100644
--- a/input/input.c
+++ b/input/input.c
@@ -128,7 +128,7 @@ static mp_cmd_t mp_cmds[] = {
{ MP_CMD_FILE_FILTER, "file_filter", 1, { { MP_CMD_ARG_INT, {0}}, {-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, { {-1,{0}} } },
+ { MP_CMD_SCREENSHOT, "screenshot", 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}} } },
@@ -396,7 +396,8 @@ static mp_cmd_bind_t def_cmd_binds[] = {
#endif
{ { 'T', 0 }, "vo_ontop" },
{ { 'f', 0 }, "vo_fullscreen" },
- { { 's', 0 }, "screenshot" },
+ { { 's', 0 }, "screenshot 0" },
+ { { 'S', 0 }, "screenshot 1" },
{ { 'w', 0 }, "panscan -0.1" },
{ { 'e', 0 }, "panscan +0.1" },
diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c
index 54939acc50..c3a9453320 100644
--- a/libmpcodecs/vf_screenshot.c
+++ b/libmpcodecs/vf_screenshot.c
@@ -27,6 +27,10 @@
struct vf_priv_s {
int frameno;
char fname[102];
+ /// shot stores current screenshot mode:
+ /// 0: don't take screenshots
+ /// 1: take single screenshot, reset to 0 afterwards
+ /// 2: take screenshots of each frame
int shot, store_slices;
int dw, dh, stride;
uint8_t *buffer;
@@ -208,7 +212,8 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
}
if(vf->priv->shot) {
- vf->priv->shot=0;
+ if (vf->priv->shot==1)
+ vf->priv->shot=0;
gen_fname(vf->priv);
if (vf->priv->fname[0]) {
if (!vf->priv->store_slices)
@@ -223,8 +228,20 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
int control (vf_instance_t *vf, int request, void *data)
{
+ /** data contains an integer argument
+ * 0: take screenshot with the next frame
+ * 1: take screenshots with each frame until the same command is given once again
+ **/
if(request==VFCTRL_SCREENSHOT) {
- vf->priv->shot=1;
+ if (data && *(int*)data) { // repeated screenshot mode
+ if (vf->priv->shot==2)
+ vf->priv->shot=0;
+ else
+ vf->priv->shot=2;
+ } else { // single screenshot
+ if (!vf->priv->shot)
+ vf->priv->shot=1;
+ }
return CONTROL_TRUE;
}
return vf_next_control (vf, request, data);
diff --git a/mplayer.c b/mplayer.c
index 2cc79ad3b2..712a9e7bf5 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -4953,7 +4953,7 @@ if(step_sec>0) {
case MP_CMD_SCREENSHOT :
if(vo_config_count){
mp_msg(MSGT_CPLAYER,MSGL_INFO,"sending VFCTRL_SCREENSHOT!\n");
- if(CONTROL_OK!=((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_SCREENSHOT, 0))
+ if(CONTROL_OK!=((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_SCREENSHOT, &cmd->args[0].v.i))
video_out->control(VOCTRL_SCREENSHOT, NULL);
}
break;