[vlc-commits] vlc_tick: add vlc_tick_from_frac() to simplify conversion from fixed rates
Steve Lhomme
git at videolan.org
Tue Sep 25 12:19:53 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 25 09:43:22 2018 +0200| [56e39d09a5d44121c2c586204652ea56c1e404fa] | committer: Steve Lhomme
vlc_tick: add vlc_tick_from_frac() to simplify conversion from fixed rates
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=56e39d09a5d44121c2c586204652ea56c1e404fa
---
include/vlc_tick.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/vlc_tick.h b/include/vlc_tick.h
index 0e54bd5408..157f6a2e38 100644
--- a/include/vlc_tick.h
+++ b/include/vlc_tick.h
@@ -107,6 +107,14 @@ static inline int64_t samples_from_vlc_tick(vlc_tick_t t, int samp_rate)
return t * samp_rate / CLOCK_FREQ;
}
+
+static inline vlc_tick_t vlc_tick_from_frac(uint64_t num, uint64_t den)
+{
+ lldiv_t d = lldiv (num, den);
+ return vlc_tick_from_sec( d.quot ) + vlc_tick_from_samples(d.rem, den);
+}
+
+
/*
* vlc_tick_t <> milliseconds (ms) conversions
*/
More information about the vlc-commits
mailing list