[FFmpeg-devel] [RFC] mpegts: Provide a monotonic timestamp to the outside world

Michael Niedermayer michaelni at gmx.at
Mon Oct 29 02:46:35 CET 2012

On Mon, Oct 29, 2012 at 01:18:59AM +0100, Harald Axmann wrote:
> Am 26.10.2012 02:00, schrieb Michael Niedermayer:
> >I think the easiest way to support a single wrap is to fix the
> >output from ->read_timestamp() and ->read_packet() so it doesnt wrap.
> >This fixup should also not change the lower bits that are known, just
> >fill in the higher ones so as to avoid wraping.
> But you mean for mpegts.c only, do you? Please see the attached

i meant utils.c, mpeg-ps at least can wrap too

> patch against current XBMC FFmpeg version, if I got it right. I am
> again saving the first PCR, but instead of substracting it, I add
> 1<<33 if I encounter a time stamp below the first PCR, which I
> consider as the condition for a wrap.

that sounds good in principle. One change i would recommand is to
subtract 1 minute from the first timestamp before using it as wrap
reference. Just incase theres something wrong with the first timestamps
so nothing gets wraped that should not.
Another problem is that the timestamps are per program you cannot
use a single reference per mpeg-ts file, you need one per program,
they can use very different zero points. that is you need to put it
in AVProgram if there are more than 1 programs.

> At the end of the patch you also see a change to utils.c, where I
> supplied the file size as maximum position for time stamp reading.
> Is there a point for doing it in the original way? The reason for
> the change is, that there is possibly a bug in current XBMC or the
> PVR addon, where a read from a position after the file end seems to
> be possible, resulting in wrong maximum time stamps and again
> seeking problems.

Is there some way to reproduce this problem with ffmpeg ?
I dont think theres a reason for the int64max there but changing it
to the correct filesize shouldnt make a difference

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121029/ee006a80/attachment.asc>

More information about the ffmpeg-devel mailing list