static int mpegts_probe(AVProbeData *p)

{

    const int size = p->buf_size;

    int maxscore = 0;

    int sumscore = 0;

    int i;

    int check_count = size / TS_FEC_PACKET_SIZE;

#define CHECK_COUNT 10

#define CHECK_BLOCK 100



    if (check_count < CHECK_COUNT)

        return 0;



    for (i = 0; i<check_count; i+=CHECK_BLOCK) {

        int left = FFMIN(check_count - i, CHECK_BLOCK);

        int score      = analyze(p->buf + TS_PACKET_SIZE     *i, TS_PACKET_SIZE     *left, TS_PACKET_SIZE     , NULL, 1);

        int dvhs_score = analyze(p->buf + TS_DVHS_PACKET_SIZE*i, TS_DVHS_PACKET_SIZE*left, TS_DVHS_PACKET_SIZE, NULL, 1);

        int fec_score  = analyze(p->buf + TS_FEC_PACKET_SIZE *i, TS_FEC_PACKET_SIZE *left, TS_FEC_PACKET_SIZE , NULL, 1);

        score = FFMAX3(score, dvhs_score, fec_score);

        sumscore += score;

        maxscore = FFMAX(maxscore, score);

    }



    sumscore = sumscore * CHECK_COUNT / check_count;

    maxscore = maxscore * CHECK_COUNT / CHECK_BLOCK;



    av_dlog(0, "TS score: %d %d\n", sumscore, maxscore);



    if      (sumscore > 6) return AVPROBE_SCORE_MAX   + sumscore - CHECK_COUNT;

    else if (maxscore > 6) return AVPROBE_SCORE_MAX/2 + sumscore - CHECK_COUNT;

    else

        return 0;

}

static int mpegts_probe(AVProbeData *p)

{

    const int size = p->buf_size;

    int maxscore = 0;

    int sumscore = 0;

    int i;

    int check_count = size / TS_FEC_PACKET_SIZE;

#define CHECK_COUNT 10

#define CHECK_BLOCK 100



    if (check_count < CHECK_COUNT)

        return 0;



    for (i = 0; i<check_count; i+=CHECK_BLOCK) {

        int left = FFMIN(check_count - i, CHECK_BLOCK);

        int score      = analyze(p->buf + TS_PACKET_SIZE     *i, TS_PACKET_SIZE     *left, TS_PACKET_SIZE     , NULL, 1);

        int dvhs_score = analyze(p->buf + TS_DVHS_PACKET_SIZE*i, TS_DVHS_PACKET_SIZE*left, TS_DVHS_PACKET_SIZE, NULL, 1);

        int fec_score  = analyze(p->buf + TS_FEC_PACKET_SIZE *i, TS_FEC_PACKET_SIZE *left, TS_FEC_PACKET_SIZE , NULL, 1);

        score = FFMAX3(score, dvhs_score, fec_score);

        sumscore += score;

        maxscore = FFMAX(maxscore, score);

    }



    sumscore = sumscore * CHECK_COUNT / check_count;

    maxscore = maxscore * CHECK_COUNT / CHECK_BLOCK;



    av_dlog(0, "TS score: %d %d\n", sumscore, maxscore);



    if      (sumscore > 6) return AVPROBE_SCORE_MAX   + sumscore - CHECK_COUNT;

    else if (maxscore > 6) return AVPROBE_SCORE_MAX/2 + sumscore - CHECK_COUNT;

    else

        return 0;

}

static int FUNC_0(AVProbeData *VAR_0)

{

    const int VAR_1 = VAR_0->buf_size;

    int VAR_2 = 0;

    int VAR_3 = 0;

    int VAR_4;

    int VAR_5 = VAR_1 / TS_FEC_PACKET_SIZE;

#define CHECK_COUNT 10

#define CHECK_BLOCK 100



    if (VAR_5 < CHECK_COUNT)

        return 0;



    for (VAR_4 = 0; VAR_4<VAR_5; VAR_4+=CHECK_BLOCK) {

        int VAR_6 = FFMIN(VAR_5 - VAR_4, CHECK_BLOCK);

        int VAR_7      = analyze(VAR_0->buf + TS_PACKET_SIZE     *VAR_4, TS_PACKET_SIZE     *VAR_6, TS_PACKET_SIZE     , NULL, 1);

        int VAR_8 = analyze(VAR_0->buf + TS_DVHS_PACKET_SIZE*VAR_4, TS_DVHS_PACKET_SIZE*VAR_6, TS_DVHS_PACKET_SIZE, NULL, 1);

        int VAR_9  = analyze(VAR_0->buf + TS_FEC_PACKET_SIZE *VAR_4, TS_FEC_PACKET_SIZE *VAR_6, TS_FEC_PACKET_SIZE , NULL, 1);

        VAR_7 = FFMAX3(VAR_7, VAR_8, VAR_9);

        VAR_3 += VAR_7;

        VAR_2 = FFMAX(VAR_2, VAR_7);

    }



    VAR_3 = VAR_3 * CHECK_COUNT / VAR_5;

    VAR_2 = VAR_2 * CHECK_COUNT / CHECK_BLOCK;



    av_dlog(0, "TS VAR_7: %d %d\n", VAR_3, VAR_2);



    if      (VAR_3 > 6) return AVPROBE_SCORE_MAX   + VAR_3 - CHECK_COUNT;

    else if (VAR_2 > 6) return AVPROBE_SCORE_MAX/2 + VAR_3 - CHECK_COUNT;

    else

        return 0;

}

static int FUNC_0(AVProbeData *VAR_0)
{ const int VAR_1 = VAR_0->buf_size; int VAR_2 = 0; int VAR_3 = 0; int VAR_4; int VAR_5 = VAR_1 / TS_FEC_PACKET_SIZE; #define CHECK_COUNT 10
#define CHECK_BLOCK 100
if (VAR_5 < CHECK_COUNT)
return 0; for (VAR_4 = 0; VAR_4<VAR_5; VAR_4+=CHECK_BLOCK) { int VAR_6 = FFMIN(VAR_5 - VAR_4, CHECK_BLOCK); int VAR_7      = analyze(VAR_0->buf + TS_PACKET_SIZE     *VAR_4, TS_PACKET_SIZE     *VAR_6, TS_PACKET_SIZE     , NULL, 1); int VAR_8 = analyze(VAR_0->buf + TS_DVHS_PACKET_SIZE*VAR_4, TS_DVHS_PACKET_SIZE*VAR_6, TS_DVHS_PACKET_SIZE, NULL, 1); int VAR_9  = analyze(VAR_0->buf + TS_FEC_PACKET_SIZE *VAR_4, TS_FEC_PACKET_SIZE *VAR_6, TS_FEC_PACKET_SIZE , NULL, 1); VAR_7 = FFMAX3(VAR_7, VAR_8, VAR_9); VAR_3 += VAR_7; VAR_2 = FFMAX(VAR_2, VAR_7); } VAR_3 = VAR_3 * CHECK_COUNT / VAR_5; VAR_2 = VAR_2 * CHECK_COUNT / CHECK_BLOCK; av_dlog(0, "TS VAR_7: %d %d\n", VAR_3, VAR_2); if      (VAR_3 > 6) return AVPROBE_SCORE_MAX   + VAR_3 - CHECK_COUNT; else if (VAR_2 > 6) return AVPROBE_SCORE_MAX/2 + VAR_3 - CHECK_COUNT; else
return 0; }