Converting VLC time into unix timestamp or boost::ptime

This forum is about all development around libVLC.
mcorb
New Cone
New Cone
Posts: 2
Joined: 24 Apr 2014 15:03

Converting VLC time into unix timestamp or boost::ptime

Postby mcorb » 24 Apr 2014 15:24

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

Rémi Denis-Courmont
Developer
Developer
Posts: 15272
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 24 Apr 2014 19:45

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.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

mcorb
New Cone
New Cone
Posts: 2
Joined: 24 Apr 2014 15:03

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

Postby mcorb » 25 Apr 2014 13:40

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) ?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 12 guests