diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-03-17 02:03:59 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-03-17 02:03:59 +0000 |
commit | 14eb3345baa6cd90fce6fa76401153c6e5ada98e (patch) | |
tree | bb703d82235b380a16beabb6bc209648d4e438e1 | |
parent | 41c8a56a1426d8c345ad270fadc37f1217ab8010 (diff) | |
download | ffmpeg-14eb3345baa6cd90fce6fa76401153c6e5ada98e.tar.gz |
simplify
Originally committed as revision 8427 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/utils.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 057493a2b2..3c175a6619 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -618,21 +618,16 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, if (presentation_delayed) { /* DTS = decompression time stamp */ /* PTS = presentation time stamp */ - if (pkt->dts == AV_NOPTS_VALUE) { - /* if we know the last pts, use it */ - if(st->last_IP_pts != AV_NOPTS_VALUE) - st->cur_dts = pkt->dts = st->last_IP_pts; - else - pkt->dts = st->cur_dts; - } else { - st->cur_dts = pkt->dts; - } + if (pkt->dts == AV_NOPTS_VALUE) + pkt->dts = st->last_IP_pts; + if (pkt->dts == AV_NOPTS_VALUE) + pkt->dts = st->cur_dts; + /* this is tricky: the dts must be incremented by the duration of the frame we are displaying, i.e. the last I or P frame */ if (st->last_IP_duration == 0) - st->cur_dts += pkt->duration; - else - st->cur_dts += st->last_IP_duration; + st->last_IP_duration = pkt->duration; + st->cur_dts = pkt->dts + st->last_IP_duration; st->last_IP_duration = pkt->duration; st->last_IP_pts= pkt->pts; /* cannot compute PTS if not present (we can compute it only |