[vlc-commits] audiobargraph_a: simplify repetition check

Rafaël Carré git at videolan.org
Wed Apr 16 14:46:40 CEST 2014


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Apr 16 14:28:29 2014 +0200| [5b2e61614005a773bc51b308abec286fb5ba3b10] | committer: Rafaël Carré

audiobargraph_a: simplify repetition check

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5b2e61614005a773bc51b308abec286fb5ba3b10
---

 modules/audio_filter/audiobargraph_a.c |   34 ++++++++++++++------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/modules/audio_filter/audiobargraph_a.c b/modules/audio_filter/audiobargraph_a.c
index 89773a5..239b9c2 100644
--- a/modules/audio_filter/audiobargraph_a.c
+++ b/modules/audio_filter/audiobargraph_a.c
@@ -209,28 +209,24 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
         }
     }
 
-    if (p_sys->bargraph) {
-        /* 6 - sent the message with the values for the BarGraph */
-        if (nbChannels > 0 && p_sys->counter % p_sys->bargraph_repetition == 0) {
-            char message[256];
-            size_t j = 0;
-
-            for (int i = 0; i < nbChannels; i++) {
-                if (j >= sizeof(message))
-                    break;
-                j += snprintf(message + j, sizeof (message),"%f:", i_value[i]);
-            }
-
-            message[--j] = '\0';
-            msg_Dbg(p_filter, "values: %s", message);
+    if (p_sys->bargraph && nbChannels > 0 && p_sys->counter++ > p_sys->bargraph_repetition) {
+        /* 6 - send the message with the values for the BarGraph */
+        p_sys->counter = 0;
+        char message[256];
+        size_t j = 0;
 
-            var_SetString(p_filter->p_libvlc, "audiobargraph_v-i_values",
-                          message);
+        for (int i = 0; i < nbChannels; i++) {
+            if (j >= sizeof(message))
+                break;
+            j += snprintf(message + j, sizeof (message),"%f:", i_value[i]);
         }
-    }
 
-    if (++p_sys->counter > p_sys->bargraph_repetition*100)
-        p_sys->counter = 0;
+        message[--j] = '\0';
+        msg_Dbg(p_filter, "values: %s", message);
+
+        var_SetString(p_filter->p_libvlc, "audiobargraph_v-i_values",
+                message);
+    }
 
     return p_in_buf;
 }



More information about the vlc-commits mailing list