changeset 36756:6e78b4f9569f

vf_screenshot: Simplify repeat screenshot handling logic.
author reimar
date Sun, 16 Feb 2014 14:47:35 +0000
parents 1644cfb31b2f
children 18518cb8a99e
files libmpcodecs/vf_screenshot.c
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_screenshot.c	Sun Feb 16 14:47:33 2014 +0000
+++ b/libmpcodecs/vf_screenshot.c	Sun Feb 16 14:47:35 2014 +0000
@@ -198,8 +198,7 @@
     }
 
     if(vf->priv->shot) {
-        if (vf->priv->shot==1)
-            vf->priv->shot=0;
+        vf->priv->shot &= ~1;
         gen_fname(vf->priv);
         if (vf->priv->fname[0]) {
             if (!vf->priv->store_slices)
@@ -220,13 +219,9 @@
      **/
     if(request==VFCTRL_SCREENSHOT) {
         if (data && *(int*)data) { // repeated screenshot mode
-            if (vf->priv->shot==2)
-                vf->priv->shot=0;
-            else
-                vf->priv->shot=2;
+            vf->priv->shot ^= 2;
         } else { // single screenshot
-            if (!vf->priv->shot)
-                vf->priv->shot=1;
+            vf->priv->shot |= 1;
         }
         return CONTROL_TRUE;
     }