mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
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
This commit is contained in:
parent
b32aa254f9
commit
21faec3791
@ -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
|
||||
|
@ -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
|
||||
|
@ -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" },
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user