diff libaf/af.h @ 24900:9079c9745ff9

A/V sync: take audio filter buffers into account Substract the delay caused by filter buffering when calculating currently playing audio position. This matters for af_scaletempo which buffers significant and varying amounts of data. For other current filters the effect is normally insignificant. Instead of the old time-based filter delay field (which was ignored) this version stores the per-filter delay in units of bytes input read without corresponding output. This allows the current scaletempo behavior where other filters before and after it can see the same nominal samplerate even though the real duration of the data varies; in this case the other filters can not know the delay they're causing in terms of real time.
author uau
date Thu, 01 Nov 2007 06:52:50 +0000
parents 80180dc13565
children d88f5f82826e
line wrap: on
line diff
--- a/libaf/af.h	Thu Nov 01 06:52:47 2007 +0000
+++ b/libaf/af.h	Thu Nov 01 06:52:50 2007 +0000
@@ -54,7 +54,8 @@
   af_data_t* data; // configuration for outgoing data stream
   struct af_instance_s* next;
   struct af_instance_s* prev;  
-  double delay; // Delay caused by the filter [ms]
+  double delay; /* Delay caused by the filter, in units of bytes read without
+		 * corresponding output */
   double mul; /* length multiplier: how much does this instance change
 		 the length of the buffer. */
 }af_instance_t;
@@ -196,7 +197,7 @@
 
 /**
  * \brief Calculate the total delay caused by the filters
- * \return delay in seconds
+ * \return delay in bytes of "missing" output
  */
 double af_calc_delay(af_stream_t* s);