static void reanalyze(MpegTSContext *ts) {

    AVIOContext *pb = ts->stream->pb;

    int64_t pos = avio_tell(pb);

    if(pos < 0)

        return;

    pos += ts->raw_packet_size - ts->pos47_full;

    if (pos == TS_PACKET_SIZE) {

        ts->size_stat[0] ++;

    } else if (pos == TS_DVHS_PACKET_SIZE) {

        ts->size_stat[1] ++;

    } else if (pos == TS_FEC_PACKET_SIZE) {

        ts->size_stat[2] ++;

    }



    ts->size_stat_count ++;

    if(ts->size_stat_count > SIZE_STAT_THRESHOLD) {

        int newsize = 0;

        if (ts->size_stat[0] > SIZE_STAT_THRESHOLD) {

            newsize = TS_PACKET_SIZE;

        } else if (ts->size_stat[1] > SIZE_STAT_THRESHOLD) {

            newsize = TS_DVHS_PACKET_SIZE;

        } else if (ts->size_stat[2] > SIZE_STAT_THRESHOLD) {

            newsize = TS_FEC_PACKET_SIZE;

        }

        if (newsize) {

            av_log(ts->stream, AV_LOG_WARNING, "changing packet size to %d\n", newsize);

            ts->raw_packet_size = newsize;

        }

        ts->size_stat_count = 0;

        memset(ts->size_stat, 0, sizeof(ts->size_stat));

    }

}

static void reanalyze(MpegTSContext *ts) {

    AVIOContext *pb = ts->stream->pb;

    int64_t pos = avio_tell(pb);

    if(pos < 0)

        return;

    pos += ts->raw_packet_size - ts->pos47_full;

    if (pos == TS_PACKET_SIZE) {

        ts->size_stat[0] ++;

    } else if (pos == TS_DVHS_PACKET_SIZE) {

        ts->size_stat[1] ++;

    } else if (pos == TS_FEC_PACKET_SIZE) {

        ts->size_stat[2] ++;

    }



    ts->size_stat_count ++;

    if(ts->size_stat_count > SIZE_STAT_THRESHOLD) {

        int newsize = 0;

        if (ts->size_stat[0] > SIZE_STAT_THRESHOLD) {

            newsize = TS_PACKET_SIZE;

        } else if (ts->size_stat[1] > SIZE_STAT_THRESHOLD) {

            newsize = TS_DVHS_PACKET_SIZE;

        } else if (ts->size_stat[2] > SIZE_STAT_THRESHOLD) {

            newsize = TS_FEC_PACKET_SIZE;

        }

        if (newsize) {

            av_log(ts->stream, AV_LOG_WARNING, "changing packet size to %d\n", newsize);

            ts->raw_packet_size = newsize;

        }

        ts->size_stat_count = 0;

        memset(ts->size_stat, 0, sizeof(ts->size_stat));

    }

}

static void FUNC_0(MpegTSContext *VAR_0) {

    AVIOContext *pb = VAR_0->stream->pb;

    int64_t pos = avio_tell(pb);

    if(pos < 0)

        return;

    pos += VAR_0->raw_packet_size - VAR_0->pos47_full;

    if (pos == TS_PACKET_SIZE) {

        VAR_0->size_stat[0] ++;

    } else if (pos == TS_DVHS_PACKET_SIZE) {

        VAR_0->size_stat[1] ++;

    } else if (pos == TS_FEC_PACKET_SIZE) {

        VAR_0->size_stat[2] ++;

    }



    VAR_0->size_stat_count ++;

    if(VAR_0->size_stat_count > SIZE_STAT_THRESHOLD) {

        int VAR_1 = 0;

        if (VAR_0->size_stat[0] > SIZE_STAT_THRESHOLD) {

            VAR_1 = TS_PACKET_SIZE;

        } else if (VAR_0->size_stat[1] > SIZE_STAT_THRESHOLD) {

            VAR_1 = TS_DVHS_PACKET_SIZE;

        } else if (VAR_0->size_stat[2] > SIZE_STAT_THRESHOLD) {

            VAR_1 = TS_FEC_PACKET_SIZE;

        }

        if (VAR_1) {

            av_log(VAR_0->stream, AV_LOG_WARNING, "changing packet size to %d\n", VAR_1);

            VAR_0->raw_packet_size = VAR_1;

        }

        VAR_0->size_stat_count = 0;

        memset(VAR_0->size_stat, 0, sizeof(VAR_0->size_stat));

    }

}

static void FUNC_0(MpegTSContext *VAR_0) { AVIOContext *pb = VAR_0->stream->pb; int64_t pos = avio_tell(pb); if(pos < 0)
return; pos += VAR_0->raw_packet_size - VAR_0->pos47_full; if (pos == TS_PACKET_SIZE) { VAR_0->size_stat[0] ++; } else if (pos == TS_DVHS_PACKET_SIZE) { VAR_0->size_stat[1] ++; } else if (pos == TS_FEC_PACKET_SIZE) { VAR_0->size_stat[2] ++; } VAR_0->size_stat_count ++; if(VAR_0->size_stat_count > SIZE_STAT_THRESHOLD) { int VAR_1 = 0; if (VAR_0->size_stat[0] > SIZE_STAT_THRESHOLD) { VAR_1 = TS_PACKET_SIZE; } else if (VAR_0->size_stat[1] > SIZE_STAT_THRESHOLD) { VAR_1 = TS_DVHS_PACKET_SIZE; } else if (VAR_0->size_stat[2] > SIZE_STAT_THRESHOLD) { VAR_1 = TS_FEC_PACKET_SIZE; } if (VAR_1) { av_log(VAR_0->stream, AV_LOG_WARNING, "changing packet size to %d\n", VAR_1); VAR_0->raw_packet_size = VAR_1; } VAR_0->size_stat_count = 0; memset(VAR_0->size_stat, 0, sizeof(VAR_0->size_stat)); } }