# HG changeset patch # User eugeni # Date 1158326879 0 # Node ID 10f36060390a623f22de7494c3a242a8b81bf8cf # Parent f9d1c83798a96f9bc56c97e9591be54a3b2675b6 Add repeated screenshot mode to vf_screenshot. It is triggered by "screenshot 1". diff -r f9d1c83798a9 -r 10f36060390a DOCS/man/en/mplayer.1 --- a/DOCS/man/en/mplayer.1 Thu Sep 14 18:29:24 2006 +0000 +++ b/DOCS/man/en/mplayer.1 Fri Sep 15 13:27:59 2006 +0000 @@ -321,6 +321,8 @@ 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 @@ . .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 -r f9d1c83798a9 -r 10f36060390a DOCS/tech/slave.txt --- a/DOCS/tech/slave.txt Thu Sep 14 18:29:24 2006 +0000 +++ b/DOCS/tech/slave.txt Fri Sep 15 13:27:59 2006 +0000 @@ -142,8 +142,10 @@ grab_frames Currently unimplemented. -screenshot +screenshot 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 -r f9d1c83798a9 -r 10f36060390a input/input.c --- a/input/input.c Thu Sep 14 18:29:24 2006 +0000 +++ b/input/input.c Fri Sep 15 13:27:59 2006 +0000 @@ -128,7 +128,7 @@ { 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 @@ #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 -r f9d1c83798a9 -r 10f36060390a libmpcodecs/vf_screenshot.c --- a/libmpcodecs/vf_screenshot.c Thu Sep 14 18:29:24 2006 +0000 +++ b/libmpcodecs/vf_screenshot.c Fri Sep 15 13:27:59 2006 +0000 @@ -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 @@ } 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 @@ 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 -r f9d1c83798a9 -r 10f36060390a mplayer.c --- a/mplayer.c Thu Sep 14 18:29:24 2006 +0000 +++ b/mplayer.c Fri Sep 15 13:27:59 2006 +0000 @@ -4953,7 +4953,7 @@ 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;