Browse Source

timefilter: allow to evaluate at other times.

Nicolas George 13 years ago
parent
commit
8a9ae37fee
2 changed files with 14 additions and 0 deletions
  1. 5 0
      libavdevice/timefilter.c
  2. 9 0
      libavdevice/timefilter.h

+ 5 - 0
libavdevice/timefilter.c

@@ -83,6 +83,11 @@ double ff_timefilter_update(TimeFilter *self, double system_time, double period)
     return self->cycle_time;
 }
 
+double ff_timefilter_eval(TimeFilter *self, double delta)
+{
+    return self->cycle_time + self->clock_period * delta;
+}
+
 #ifdef TEST
 #include "libavutil/lfg.h"
 #define LFG_MAX ((1LL << 32) - 1)

+ 9 - 0
libavdevice/timefilter.h

@@ -81,6 +81,15 @@ TimeFilter * ff_timefilter_new(double clock_period, double feedback2_factor, dou
  */
 double ff_timefilter_update(TimeFilter *self, double system_time, double period);
 
+/**
+ * Evaluate the filter at a specified time
+ *
+ * @param delta  difference between the requested time and the current time
+ *               (last call to ff_timefilter_update).
+ * @return  the filtered time
+ */
+double ff_timefilter_eval(TimeFilter *self, double delta);
+
 /**
  * Reset the filter
  *