Revision 2031ba1b libavformat/mpeg.c

View differences:

libavformat/mpeg.c
275 275
            goto fail;
276 276
        st->priv_data = stream;
277 277

  
278
        av_set_pts_info(st, 64, 1, 90000);
279

  
278 280
        switch(st->codec.codec_type) {
279 281
        case CODEC_TYPE_AUDIO:
280 282
            if (st->codec.codec_id == CODEC_ID_AC3) {
......
1017 1019
    if(s->is_svcd) {
1018 1020
        /* offset pts and dts slightly into the future to be able
1019 1021
           to do the compatibility fix below.*/
1020
        pts = (pts + 2) & ((1LL << 33) - 1);
1021
        dts = (dts + 2) & ((1LL << 33) - 1);
1022
        pts += 2;
1023
        dts += 2;
1022 1024

  
1023 1025
        if (stream->packet_number == 0 && dts == pts)
1024 1026
            /* For the very first packet we want to force the DTS to be included.
1025 1027
               This increases compatibility with lots of DVD players.
1026 1028
               Since the MPEG-2 standard mandates that DTS is only written when
1027 1029
               it is different from PTS we have to move it slightly into the past.*/
1028
            dts = (dts - 2) & ((1LL << 33) - 1);
1030
            dts -= 2;
1029 1031
    }
1030 1032
    if(s->is_vcd) {
1031 1033
        /* We have to offset the PTS, so that it is consistent with the SCR.
......
1033 1035
           and the first pack from the other stream, respectively, may also have
1034 1036
           been written before.
1035 1037
           So the real data starts at SCR 36000+3*1200. */
1036
        pts = (pts + 36000 + 3600) & ((1LL << 33) - 1);
1037
        dts = (dts + 36000 + 3600) & ((1LL << 33) - 1);
1038
        pts += 36000 + 3600;
1039
        dts += 36000 + 3600;
1038 1040
    }else{
1039
        pts = (pts + PRELOAD) & ((1LL << 33) - 1);
1040
        dts = (dts + PRELOAD) & ((1LL << 33) - 1);
1041
        pts += PRELOAD;
1042
        dts += PRELOAD;
1041 1043
    }
1042
    
1044
//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);
1043 1045
    *stream->next_packet=
1044 1046
    pkt_desc= av_mallocz(sizeof(PacketDesc));
1045 1047
    pkt_desc->pts= pts;

Also available in: Unified diff