add_pes_stream(ts, pid);
add_pes_stream(ts, pid, 0);
static void handle_packet(MpegTSContext *ts, const uint8_t *packet){    AVFormatContext *s = ts->stream;    MpegTSFilter *tss;    int len, pid, cc, cc_ok, afc, is_start;    const uint8_t *p, *p_end;    pid = ((packet[1] & 0x1f) << 8) | packet[2];    is_start = packet[1] & 0x40;    tss = ts->pids[pid];    if (ts->auto_guess && tss == NULL && is_start) {        add_pes_stream(ts, pid);        tss = ts->pids[pid];    }    if (!tss)        return;    /* continuity check (currently not used) */    cc = (packet[3] & 0xf);    cc_ok = (tss->last_cc < 0) || ((((tss->last_cc + 1) & 0x0f) == cc));    tss->last_cc = cc;        /* skip adaptation field */    afc = (packet[3] >> 4) & 3;    p = packet + 4;    if (afc == 0) /* reserved value */        return;    if (afc == 2) /* adaptation field only */        return;    if (afc == 3) {        /* skip adapation field */        p += p[0] + 1;    }    /* if past the end of packet, ignore */    p_end = packet + TS_PACKET_SIZE;    if (p >= p_end)        return;        if (tss->type == MPEGTS_SECTION) {        if (is_start) {            /* pointer field present */            len = *p++;            if (p + len > p_end)                return;            if (len && cc_ok) {                /* write remaning section bytes */                write_section_data(s, tss,                                    p, len, 0);            }            p += len;            if (p < p_end) {                write_section_data(s, tss,                                    p, p_end - p, 1);            }        } else {            if (cc_ok) {                write_section_data(s, tss,                                    p, p_end - p, 0);            }        }    } else {        tss->u.pes_filter.pes_cb(tss->u.pes_filter.opaque,                                  p, p_end - p, is_start);    }}