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

Michael Niedermayer michaelni at gmx.at
Mon Oct 29 17:55:33 CET 2012

On Mon, Oct 29, 2012 at 05:17:09PM +0100, Harald Axmann wrote:
> Am 29.10.2012 02:46, schrieb Michael Niedermayer:
> >On Mon, Oct 29, 2012 at 01:18:59AM +0100, Harald Axmann wrote:
> >>But you mean for mpegts.c only, do you? Please see the attached
> >i meant utils.c, mpeg-ps at least can wrap too
> I think a common fix is a little complex. E.g. programs seem to be
> TS specific.

you can use AVStream directly instead of the program if that works

> So the condition for the wrap is depending on the
> stream type. Than the index is filled from mpegts directly. So it is
> needed to check for the wrap there too. That's why I am stuck to
> mpegts again. I think mpegps should be fixed separately.

You can add the 2 lines for correction to av_add_index_entry()

But a mpegts only hack of a wrap only hack is too much hack IMHO


> @@ -713,6 +715,13 @@ static uint64_t get_bits64(GetBitContext *gb, int bits)
>      return ret;
>  }
> +static int64_t wrap_timestamp(PESContext *pes, int64_t timestamp)
> +{
> +    if (timestamp < pes->initial_ts - (60*pes->st->time_base.den))
> +        return timestamp + (1LL<<pes->st->pts_wrap_bits);
> +    return timestamp;

initial_ts itself can be offset instead of doing it for each use of

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- 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/96a6e716/attachment.asc>

More information about the ffmpeg-devel mailing list