]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/ratelimit.h
remap: Change remapping function argument type from void to int16_t / float as approp...
[pulseaudio] / src / pulsecore / ratelimit.h
index ec3b5a38a7c8087d23a1d78eac6fea2664a41d1e..036646230ffcf3c001afd9815c6863edf2d61538 100644 (file)
 ***/
 
 #include <pulse/sample.h>
+#include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 
 typedef struct pa_ratelimit {
-    const pa_usec_t interval;
-    const unsigned burst;
+    pa_usec_t interval;
+    unsigned burst;
     unsigned n_printed, n_missed;
     pa_usec_t begin;
 } pa_ratelimit;
 
 #define PA_DEFINE_RATELIMIT(_name, _interval, _burst)   \
     pa_ratelimit _name = {                              \
-        .interval = _interval,                          \
-        .burst = _burst,                                \
+        .interval = (_interval),                        \
+        .burst = (_burst),                              \
         .n_printed = 0,                                 \
         .n_missed = 0,                                  \
         .begin = 0                                      \
     }
 
-pa_bool_t pa_ratelimit_test(pa_ratelimit *r);
+#define PA_INIT_RATELIMIT(v, _interval, _burst)         \
+    do {                                                \
+        pa_ratelimit *r = &(v);                         \
+        r->interval = (_interval);                      \
+        r->burst = (_burst);                            \
+        r->n_printed = 0;                               \
+        r->n_missed = 0;                                \
+        r->begin = 0;                                   \
+    } while (false);
+
+bool pa_ratelimit_test(pa_ratelimit *r, pa_log_level_t t);
 
 #endif