[FFmpeg-cvslog] r15015 - trunk/libavformat/utils.c

michael subversion
Fri Aug 29 03:43:27 CEST 2008


Author: michael
Date: Fri Aug 29 03:43:27 2008
New Revision: 15015

Log:
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.


Modified:
   trunk/libavformat/utils.c

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Fri Aug 29 03:43:27 2008
@@ -2574,18 +2574,6 @@ static int compute_pkt_fields2(AVStream 
     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, A
     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(AVFormatC
         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);




More information about the ffmpeg-cvslog mailing list