diff libmpcodecs/vf_screenshot.c @ 19833:10f36060390a

Add repeated screenshot mode to vf_screenshot. It is triggered by "screenshot 1".
author eugeni
date Fri, 15 Sep 2006 13:27:59 +0000
parents cc65a585fdcc
children 29c478a2483f
line wrap: on
line diff
--- 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);