summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vf_screenshot.c21
1 files changed, 19 insertions, 2 deletions
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);