changeset 3791:6a1d266be2fc libavformat

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.
author michael
date Fri, 29 Aug 2008 01:43:27 +0000
parents a8a70ae19206
children a6d4e93e171b
files utils.c
diffstat 1 files changed, 0 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Thu Aug 28 22:41:00 2008 +0000
+++ b/utils.c	Fri Aug 29 01:43:27 2008 +0000
@@ -2574,18 +2574,6 @@
     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 @@
     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 @@
         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 @@
         if(!ret)
             break;
 
-        truncate_ts(s->streams[pkt.stream_index], &pkt);
         ret= s->oformat->write_packet(s, &pkt);
 
         av_free_packet(&pkt);