From f0aaa16fdfdcfc54418c5f2fce5ea2e693309c8d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 29 Aug 2008 01:43:27 +0000 Subject: [PATCH] Do not truncate timestamps before the muxer as it makes simple things like last_pts - pts rather tricky and is not good for anything. Timestamps should be truncated just before storing when needed. Originally committed as revision 15015 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/utils.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 91b105f3e1..ee6a71e439 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2574,18 +2574,6 @@ static int compute_pkt_fields2(AVStream *st, AVPacket *pkt){ return 0; } -static void truncate_ts(AVStream *st, AVPacket *pkt){ - int64_t pts_mask = (2LL << (st->pts_wrap_bits-1)) - 1; - -// if(pkt->dts < 0) -// pkt->dts= 0; //this happens for low_delay=0 and B-frames, FIXME, needs further investigation about what we should do here - - if (pkt->pts != AV_NOPTS_VALUE) - pkt->pts &= pts_mask; - if (pkt->dts != AV_NOPTS_VALUE) - pkt->dts &= pts_mask; -} - int av_write_frame(AVFormatContext *s, AVPacket *pkt) { int ret = compute_pkt_fields2(s->streams[pkt->stream_index], pkt); @@ -2593,8 +2581,6 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt) if(ret<0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) return ret; - truncate_ts(s->streams[pkt->stream_index], pkt); - ret= s->oformat->write_packet(s, pkt); if(!ret) ret= url_ferror(s->pb); @@ -2690,7 +2676,6 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){ if(ret<=0) //FIXME cleanup needed for ret<0 ? return ret; - truncate_ts(s->streams[opkt.stream_index], &opkt); ret= s->oformat->write_packet(s, &opkt); av_free_packet(&opkt); @@ -2715,7 +2700,6 @@ int av_write_trailer(AVFormatContext *s) if(!ret) break; - truncate_ts(s->streams[pkt.stream_index], &pkt); ret= s->oformat->write_packet(s, &pkt); av_free_packet(&pkt);