remove wrong 33bit truncation of internal timestamps

Originally committed as revision 3554 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 21 years ago
parent bc3429e382
commit 2031ba1bf2
  1. 18
      libavformat/mpeg.c

@ -275,6 +275,8 @@ static int mpeg_mux_init(AVFormatContext *ctx)
goto fail; goto fail;
st->priv_data = stream; st->priv_data = stream;
av_set_pts_info(st, 64, 1, 90000);
switch(st->codec.codec_type) { switch(st->codec.codec_type) {
case CODEC_TYPE_AUDIO: case CODEC_TYPE_AUDIO:
if (st->codec.codec_id == CODEC_ID_AC3) { if (st->codec.codec_id == CODEC_ID_AC3) {
@ -1017,15 +1019,15 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
if(s->is_svcd) { if(s->is_svcd) {
/* offset pts and dts slightly into the future to be able /* offset pts and dts slightly into the future to be able
to do the compatibility fix below.*/ to do the compatibility fix below.*/
pts = (pts + 2) & ((1LL << 33) - 1); pts += 2;
dts = (dts + 2) & ((1LL << 33) - 1); dts += 2;
if (stream->packet_number == 0 && dts == pts) if (stream->packet_number == 0 && dts == pts)
/* For the very first packet we want to force the DTS to be included. /* For the very first packet we want to force the DTS to be included.
This increases compatibility with lots of DVD players. This increases compatibility with lots of DVD players.
Since the MPEG-2 standard mandates that DTS is only written when 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.*/ it is different from PTS we have to move it slightly into the past.*/
dts = (dts - 2) & ((1LL << 33) - 1); 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.
@ -1033,13 +1035,13 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
and the first pack from the other stream, respectively, may also have and the first pack from the other stream, respectively, may also have
been written before. been written before.
So the real data starts at SCR 36000+3*1200. */ So the real data starts at SCR 36000+3*1200. */
pts = (pts + 36000 + 3600) & ((1LL << 33) - 1); pts += 36000 + 3600;
dts = (dts + 36000 + 3600) & ((1LL << 33) - 1); dts += 36000 + 3600;
}else{ }else{
pts = (pts + PRELOAD) & ((1LL << 33) - 1); pts += PRELOAD;
dts = (dts + PRELOAD) & ((1LL << 33) - 1); dts += PRELOAD;
} }
//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index);
*stream->next_packet= *stream->next_packet=
pkt_desc= av_mallocz(sizeof(PacketDesc)); pkt_desc= av_mallocz(sizeof(PacketDesc));
pkt_desc->pts= pts; pkt_desc->pts= pts;

Loading…
Cancel
Save