Ticket #1719: mpegts_fix_long_pmt.diff

File mpegts_fix_long_pmt.diff, 1.3 KB (added by aurelien, 4 years ago)
  • libavformat/mpegts.c

    diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
    index c2e3c8c..49c6802 100644
    a b struct MpegTSContext { 
    119119    /******************************************/ 
    120120    /* private mpegts data */ 
    121121    /* scan context */ 
     122    unsigned int pat_version; 
    122123    /** structure to keep track of Program->pids mapping     */ 
    123124    unsigned int nb_prg; 
    124125    struct Program *prg; 
    static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len 
    15591560        return; 
    15601561    if (h->tid != PAT_TID) 
    15611562        return; 
     1563    if (h->version == ts->pat_version) 
     1564        return; 
    15621565 
    15631566    ts->stream->ts_id = h->id; 
     1567    ts->pat_version = h->version; 
    15641568 
    15651569    clear_programs(ts); 
    15661570    for(;;) { 
    static int mpegts_read_header(AVFormatContext *s) 
    19331937    } 
    19341938    ts->stream = s; 
    19351939    ts->auto_guess = 0; 
     1940    ts->pat_version = 32; // use an impossible value 
    19361941 
    19371942    if (s->iformat == &ff_mpegts_demuxer) { 
    19381943        /* normal demux */ 
    MpegTSContext *ff_mpegts_parse_open(AVFormatContext *s) 
    21732178    ts->raw_packet_size = TS_PACKET_SIZE; 
    21742179    ts->stream = s; 
    21752180    ts->auto_guess = 1; 
     2181    ts->pat_version = 32; // use an impossible value 
    21762182    mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1); 
    21772183    mpegts_open_section_filter(ts, PAT_PID, pat_cb, ts, 1); 
    21782184