[vlc-devel] [PATCH 06/15] vlc_common: add helper fonctions to convert from mtime_t to floating point seconds

Steve Lhomme robux4 at ycbcr.xyz
Sat Jun 16 10:44:05 CEST 2018


On 2018-06-16 10:27 AM, Rémi Denis-Courmont wrote:
> Le lauantaina 16. kesäkuuta 2018, 10.37.13 EEST Steve Lhomme a écrit :
>> In many case where it's used it's not obvious the output is requested in
>> float rather than int. Like sout << secf_from_vtick()
> And? Type selection is done by the input, not the output.

So we could have vtick_from_sec() with auto selection (seems to cover 
all the cases I found) but need separate sec(f)_from_vtick() ?

It found 3 cases where the conversion to floating point is not obvious:

http://git.videolan.org/?p=vlc.git;a=blob;f=src/input/control.c;h=e92ab3a3f82f8585d9ccd3bbdc93a74d1e8e4b32;hb=HEAD#l613
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/stream_out/chromecast/chromecast_ctrl.cpp;h=3e157e7f5e2c349e636e3a9dac4924ae6f19c5cd;hb=HEAD#l1063
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/video_filter/blendbench.c;h=f1aa544e403a478faa9f98d7a5c5802d91af67d3;hb=HEAD#l263

>
>> Also the rounding may not be the same. For floating point llround() is
>> used in a few places. For integer it may be different although
>> everything I saw implied rounding down.
> If you care about rounding, you cannot use those macros or functions anyway.
> The use case will need to convert manually as fits.
>



More information about the vlc-devel mailing list