initial dts fix

Originally committed as revision 3555 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2004-10-03 12:58:14 +00:00
parent 2031ba1bf2
commit e0c91bc23b
3 changed files with 3 additions and 16 deletions

View File

@ -1016,19 +1016,6 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
pts= pkt->pts; pts= pkt->pts;
dts= pkt->dts; dts= pkt->dts;
if(s->is_svcd) {
/* offset pts and dts slightly into the future to be able
to do the compatibility fix below.*/
pts += 2;
dts += 2;
if (stream->packet_number == 0 && dts == pts)
/* For the very first packet we want to force the DTS to be included.
This increases compatibility with lots of DVD players.
Since the MPEG-2 standard mandates that DTS is only written when
it is different from PTS we have to move it slightly into the past.*/
dts -= 2;
}
if(s->is_vcd) { if(s->is_vcd) {
/* We have to offset the PTS, so that it is consistent with the SCR. /* We have to offset the PTS, so that it is consistent with the SCR.
SCR starts at 36000, but the first two packs contain only padding SCR starts at 36000, but the first two packs contain only padding

View File

@ -1979,8 +1979,8 @@ static void compute_pkt_fields2(AVStream *st, AVPacket *pkt){
static void truncate_ts(AVStream *st, AVPacket *pkt){ static void truncate_ts(AVStream *st, AVPacket *pkt){
int64_t pts_mask = (2LL << (st->pts_wrap_bits-1)) - 1; int64_t pts_mask = (2LL << (st->pts_wrap_bits-1)) - 1;
if(pkt->dts < 0) // if(pkt->dts < 0)
pkt->dts= 0; //this happens for low_delay=0 and b frames, FIXME, needs further invstigation about what we should do here // pkt->dts= 0; //this happens for low_delay=0 and b frames, FIXME, needs further invstigation about what we should do here
pkt->pts &= pts_mask; pkt->pts &= pts_mask;
pkt->dts &= pts_mask; pkt->dts &= pts_mask;

View File

@ -7,7 +7,7 @@ ffmpeg regression test
./data/b-libav.asf CRC=750f18c7 ./data/b-libav.asf CRC=750f18c7
1cbf838e659d7fc3d3e33f4187b91f6c *./data/b-libav.rm 1cbf838e659d7fc3d3e33f4187b91f6c *./data/b-libav.rm
360251 ./data/b-libav.rm 360251 ./data/b-libav.rm
65af12e9d9e8eb76af5efdadf769d7d7 *./data/b-libav.mpg 7aeebe6bf43c0c1219e41ce082a47051 *./data/b-libav.mpg
387072 ./data/b-libav.mpg 387072 ./data/b-libav.mpg
./data/b-libav.mpg CRC=16c74225 ./data/b-libav.mpg CRC=16c74225
57a8dfc7926802bb337a9d8918de94a8 *./data/b-libav.swf 57a8dfc7926802bb337a9d8918de94a8 *./data/b-libav.swf