<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 2018-06-07 1:15 PM, Rémi Denis-Courmont wrote:<br>
<blockquote type="cite"
cite="mid:A90D19FE-5F17-4AC4-982F-830F7168522D@remlab.net">Should
there be a VLC prefix? How to handle rounding errors? :/<br>
</blockquote>
<br>
I would say yes on the prefix but that's going to be very lengthy
names. Also mtime_t is not vlc_mtime_t.<br>
<br>
The rounding errors it's a little tricky for a macro. I was thinking
about using macros for hardcoded values and a function for local
values.<br>
<br>
There are currently many static_assert on CLOCK_FREQ like this one<br>
<a class="moz-txt-link-freetext" href="http://git.videolan.org/?p=vlc.git;a=blob;f=modules/audio_output/wasapi.c;hb=HEAD#l130">http://git.videolan.org/?p=vlc.git;a=blob;f=modules/audio_output/wasapi.c;hb=HEAD#l130</a><br>
<br>
For now CLOCK_FREQ it's pretty much lock into 1000000 so the only
thing that can happen here is MTIME_TO_MS() overflowing when it
shouldn't.<br>
<br>
I would like to make the code more flexible though to allow more
arbitrary values like that Facebook tick or using 100ns on Windows
where it's more natural.<br>
<blockquote type="cite"
cite="mid:A90D19FE-5F17-4AC4-982F-830F7168522D@remlab.net"><br>
<div class="gmail_quote">Le 7 juin 2018 12:59:45 GMT+03:00, Steve
Lhomme <a class="moz-txt-link-rfc2396E" href="mailto:robux4@ycbcr.xyz"><robux4@ycbcr.xyz></a> a écrit :
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<pre class="k9mail">From: Rémi Denis-Courmont <a class="moz-txt-link-rfc2396E" href="mailto:remi@remlab.net"><remi@remlab.net></a>
---
include/vlc_common.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index da334710af..d79ed61221 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -288,6 +288,10 @@
*/
typedef int64_t mtime_t;
+#define MS_TO_MTIME(ms) ((ms) * (CLOCK_FREQ / 1000))
+#define MTIME_TO_MS(ms) (((ms) * 1000) / CLOCK_FREQ)
+
+
/**
* The vlc_fourcc_t type.
*</pre>
</blockquote>
</div>
<br>
-- <br>
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez
excuser ma brièveté.
<!--'"--><br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
<a class="moz-txt-link-freetext" href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre>
</blockquote>
<br>
</body>
</html>