Page 1 of 1

Converting VLC time into unix timestamp or boost::ptime

Posted: 24 Apr 2014 15:24
by mcorb
Hi all,

I am using libvlc for parsing audio streams using audio callbacks (libvlc_audio_play_cb in particular) and I would like to keep track of time for later use. When reading the doxygen, I see that current audio samples arrive together with a expected play time stamp (I believe for the first sample given by the callback) which its origin is arbitrary.

Is there any rule to convert VLC time domain (this expected play time stamp) to Unix time stamps ?

Best

Re: Converting VLC time into unix timestamp or boost::ptime

Posted: 24 Apr 2014 19:45
by Rémi Denis-Courmont
libvlc_clock() gives the current VLC time. In practice, this is the POSIX monotonic clock where available.

That said, you really should NEVER EVER convert audio timestamps to epoch time. The offset between VLC time and the epoch is not strictly constant.

Re: Converting VLC time into unix timestamp or boost::ptime

Posted: 25 Apr 2014 13:40
by mcorb
Thanks Rémi,

Extra question then, I do not see exactly where the VLC time and epoch offset might vary.
Is there any doc I can read that explain how VLC time works (and how is it that the offset to epoch might vary) ?