[vlc-devel] [PATCH 00/15 v2] timestamp/tick cleaning

Steve Lhomme robux4 at ycbcr.xyz
Fri Jun 15 17:09:11 CEST 2018


This is a different take on all the mtime_t use cleaning. This time there are
macros to convert to/from milliseconds and to/from seconds.

There are also functions to do the same thing, to be used with variables (ie
not hardcoded values) so overflow could be handled in the future.

There are also functions to convert to/from microseconds which is equality for
now but allows chaning CLOCK_FREQ in the future without having to care about 
such cases. This will be possible once all the code doesn't make any direct or
implied calls to CLOCK_FREQ. I have all the patches ready to do that.

There are also functions to convert to/from nanoseconds (like in Matroska),
our msftime_t (100ns based sources) and floating point seconds, usually used
with strings to write an mtime_t with more precision than a second.

The functions/macros are named VTICK_xxx because I would like to rename mtime_t
to vlc_tick_t for more clarity.

They also have for X_from_Y where X is the type of the output and Y the type of
the input, making is easier to know what we read from and what we get in the end.

I provided some examples of use of the macros (basic search & replace in the
code). There's a lot more to follow once we're settled on the names and
conversion operations.

RĂ©mi Denis-Courmont (1):
  vlc_common: add helper function to convert milliseconds to/from
    mtime_t

Steve Lhomme (14):
  vlc_common: add helper macros to convert to/from seconds/mtime_t
    explicitly
  vlc_common: add helper functions to convert (milli)seconds to/from
    mtime_t
  vlc_common: add helper function for explicit nanosecond to/from
    mtime_t conversion
  vlc_common: add helper function to convert microseconds to/from
    mtime_t
  vlc_common: add helper fonctions to convert from mtime_t to floating
    point seconds
  vlc_common: add msftime_t to express 100ns time
  vlc_common: add helper function for explicit msftime to/from mtime_t
    conversion
  vlc_common: add VLC_TICK_EPSILON to express the tiniest mtime_t tick
    that can be used
  include: replace hardcoded CLOCK_FREQ multiples by VTICK_FROM_SEC()
  core: replace hardcoded CLOCK_FREQ multiples by VTICK_FROM_SEC()
  modules: replace hardcoded CLOCK_FREQ multiples by VTICK_FROM_SEC()
  include: replace hardcoded CLOCK_FREQ fractions by VTICK_FROM_MILLI()
  core: replace hardcoded CLOCK_FREQ fractions by VTICK_FROM_MILLI()
  modules: replace hardcoded CLOCK_FREQ fractions by VTICK_FROM_MILLI()

 include/vlc_aout.h                            |  2 +-
 include/vlc_common.h                          | 68 +++++++++++++++++++
 include/vlc_config.h                          |  4 +-
 include/vlc_threads.h                         |  2 +-
 modules/access/dvb/access.c                   |  2 +-
 modules/access/live555.cpp                    |  2 +-
 modules/access/mms/mmstu.c                    |  2 +-
 modules/codec/zvbi.c                          |  2 +-
 modules/demux/adaptive/PlaylistManager.cpp    |  8 +--
 .../logic/NearOptimalAdaptationLogic.cpp      |  4 +-
 .../adaptive/playlist/AbstractPlaylist.cpp    |  2 +-
 modules/demux/asf/asf.c                       |  2 +-
 modules/demux/flac.c                          |  4 +-
 modules/demux/hls/playlist/M3U8.cpp           |  2 +-
 modules/demux/mp4/mp4.c                       |  4 +-
 modules/demux/sid.cpp                         |  2 +-
 modules/demux/smf.c                           |  2 +-
 modules/demux/smooth/playlist/Manifest.cpp    |  2 +-
 .../gui/macosx/VLCBookmarksWindowController.m |  6 +-
 modules/gui/qt/dialogs/bookmarks.cpp          |  6 +-
 modules/lua/extension.h                       |  2 +-
 modules/packetizer/h264.c                     |  2 +-
 modules/services_discovery/mtp.c              |  2 +-
 modules/spu/mosaic.c                          |  2 +-
 modules/video_filter/oldmovie.c               | 18 ++---
 modules/video_filter/vhs.c                    |  8 +--
 src/clock/input_clock.c                       |  2 +-
 src/input/demux_chained.c                     |  2 +-
 src/input/input_internal.h                    |  2 +-
 src/test/timer.c                              |  8 +--
 src/video_output/video_output.c               |  2 +-
 31 files changed, 123 insertions(+), 55 deletions(-)

-- 
2.17.0



More information about the vlc-devel mailing list