Ticket #789: mythtv_novideopts_laf.patch

File mythtv_novideopts_laf.patch, 2.1 KB (added by Mark Spieth, 18 years ago)
  • libs/libavformat/utils.c

     
    545545    ic->iformat = fmt;
    546546    ic->duration = AV_NOPTS_VALUE;
    547547    ic->start_time = AV_NOPTS_VALUE;
     548    ic->last_IP_pts = AV_NOPTS_VALUE;
    548549    pstrcpy(ic->filename, sizeof(ic->filename), filename);
    549550
    550551    /* allocate private data */
     
    894897            if(st->last_IP_pts != AV_NOPTS_VALUE)
    895898                st->cur_dts = pkt->dts = st->last_IP_pts;
    896899            else
    897                 pkt->dts = st->cur_dts;
     900                /* if any other stream has already seen a pts, use it in preference */
     901                if (s->last_IP_pts != AV_NOPTS_VALUE)
     902                    st->cur_dts = pkt->dts = s->last_IP_pts;
     903                else
     904                    pkt->dts = st->cur_dts;
    898905        } else {
    899906            st->cur_dts = pkt->dts;
    900907        }
     
    906913            st->cur_dts += st->last_IP_duration;
    907914        st->last_IP_duration  = pkt->duration;
    908915        st->last_IP_pts= pkt->pts;
     916        /* save in case any stream doesnt have pts' */
     917        if (s->last_IP_pts == AV_NOPTS_VALUE)
     918            s->last_IP_pts = st->last_IP_pts;
    909919        /* cannot compute PTS if not present (we can compute it only
    910920           by knowing the futur */
    911921    } else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){
     
    12031213    /* fail safe */
    12041214    s->cur_ptr = NULL;
    12051215    s->cur_len = 0;
     1216    s->last_IP_pts = AV_NOPTS_VALUE;
    12061217   
    12071218    /* for each stream, reset read state */
    12081219    for(i = 0; i < s->nb_streams; i++) {
  • libs/libavformat/avformat.h

     
    348348   
    349349    int flags;
    350350#define AVFMT_FLAG_GENPTS       0x0001 ///< generate pts if missing even if it requires parsing future frames
     351    /* used in case a stream never has pts, set up any stream that has pts' */
     352    int64_t last_IP_pts;
    351353} AVFormatContext;
    352354
    353355typedef struct AVPacketList {