[MPlayer-dev-eng] [PATCH] Get Demuxer Time for Proper DVD Time REDUX

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Jul 16 08:05:50 CEST 2010


On Thu, Jul 15, 2010 at 12:30:52PM -0700, Paul Huwe wrote:
> > I've created a small tweak to add a slave command
> > "get_demux_time_pos" to return the present demuxer time as a
> > float (out to 3 digits, aka millisecond accuracy). I was
> > inspired to create this because "get_time_pos" gets reset to
> > zero during the course of playing a DVD and I need the
> > proper DVD time throughout (to sub-second accuracy).
> > Searching on google showed numerous posts where others have
> > a need for a timer that does not reset. 
> >
> > The patch consists of small tweaks to 5 files:
> >
> input/input.h, input/input.c, libmpdemux/demuxer.h, libmpdemux/demuxer.c, and command.c
> 
> > That's it. I've tested it out with several DVDs, and it
> > outputs the demux time properly. 
> > 
> > In addition to giving timing information for DVDs and
> > possibly other media, it can help front-end "seekbars" that
> > rely on get_time_pos, and thus get munged during DVD
> > playback (like, say, in SMPlayer).
> 
> Patch file is attached to this mail. Patched to rev 31742.

First, the name is rather bad, it is the stream time, not the demuxer time.
The demuxer is only involved because there might be a lot of packets buffer
and thus the time stamps need to be buffered along with them.
And the time is probably still off a bit.
Also, for this kind of thing it is much preferable to provide it via get_property.
(see mp_properties table in command.c).
Lastly, I have some doubts about doing a fallback: first, as you do it it is incomplete,
failing for audio-only. It also discards the information whether a stream pts is
available, which makes the difference between reliable/non-warp-around timestamps
(DVD) or not (playing the same vob after copying it from the DVD).


More information about the MPlayer-dev-eng mailing list