[FFmpeg-devel] [PATCH 1/2] avformat/mux: support shifting timestamps so they start at 0

Michael Niedermayer michaelni at gmx.at
Sat Feb 22 22:51:56 CET 2014


On Fri, Feb 21, 2014 at 07:33:10AM +0100, Clément Bœsch wrote:
> On Fri, Feb 21, 2014 at 04:21:36AM +0100, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavformat/mux.c           |    2 +-
> >  libavformat/options_table.h |    2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavformat/mux.c b/libavformat/mux.c
> > index 2241dbe..1c15a91 100644
> > --- a/libavformat/mux.c
> > +++ b/libavformat/mux.c
> > @@ -538,7 +538,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
> >          AVStream *st = s->streams[pkt->stream_index];
> >          int64_t offset = st->mux_ts_offset;
> >  
> > -        if (pkt->dts < 0 && pkt->dts != AV_NOPTS_VALUE && !s->offset) {
> > +        if ((pkt->dts < 0 || s->avoid_negative_ts == 2) && pkt->dts != AV_NOPTS_VALUE && !s->offset) {
> >              s->offset = -pkt->dts;
> >              s->offset_timebase = st->time_base;
> >          }
> > diff --git a/libavformat/options_table.h b/libavformat/options_table.h
> > index ca30fd2..2e08682 100644
> > --- a/libavformat/options_table.h
> > +++ b/libavformat/options_table.h
> > @@ -73,7 +73,7 @@ static const AVOption avformat_options[] = {
> >  {"compliant",  "consider all spec non compliancies as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_COMPLIANT }, INT_MIN, INT_MAX, D, "err_detect"},
> >  {"aggressive", "consider things that a sane encoder shouldn't do as an error", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_AGGRESSIVE }, INT_MIN, INT_MAX, D, "err_detect"},
> >  {"use_wallclock_as_timestamps", "use wallclock as timestamps", OFFSET(use_wallclock_as_timestamps), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, D},
> > -{"avoid_negative_ts", "shift timestamps to make them non-negative. 1 enables, 0 disables, default of -1 enables when required by target format.", OFFSET(avoid_negative_ts), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, E},
> > +{"avoid_negative_ts", "shift timestamps so they start at 0. 1 enable if negative ts, 2 enable, 0 disables, default of -1 enables when required by target format.", OFFSET(avoid_negative_ts), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, E},
> 
> why don't you just add const values?

patch for that submitted

patches from this thread applied

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- 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/20140222/81733038/attachment.asc>


More information about the ffmpeg-devel mailing list