static int mpegps_probe(AVProbeData *p)
{
    uint32_t code= -1;
    int sys=0, pspack=0, priv1=0, vid=0, audio=0, invalid=0;
    int i;
    int score=0;
    for(i=0; i<p->buf_size; i++){
        code = (code<<8) + p->buf[i];
        if ((code & 0xffffff00) == 0x100) {
            int pes= check_pes(p->buf+i, p->buf+p->buf_size);
            if(code == SYSTEM_HEADER_START_CODE) sys++;
            else if(code == PRIVATE_STREAM_1)    priv1++;
            else if(code == PACK_START_CODE)     pspack++;
            else if((code & 0xf0) == VIDEO_ID && pes) vid++;
            else if((code & 0xe0) == AUDIO_ID && pes) audio++;
            else if((code & 0xf0) == VIDEO_ID && !pes) invalid++;
            else if((code & 0xe0) == AUDIO_ID && !pes) invalid++;
        }
    }
    if(vid+audio > invalid)
        score= AVPROBE_SCORE_MAX/4;
    if(sys>invalid && sys*9 <= pspack*10)
        return AVPROBE_SCORE_MAX/2+2;
    if(priv1 + vid + audio > invalid && (priv1+vid+audio)*9 <= pspack*10)
        return AVPROBE_SCORE_MAX/2+2;
    if((!!vid ^ !!audio) && (audio+vid > 1) && !sys && !pspack && p->buf_size>2048)
        return AVPROBE_SCORE_MAX/2+2;
    return score;
}
['static int mpegps_probe(AVProbeData *p)\n{\n    uint32_t code= -1;\n    int sys=0, pspack=0, priv1=0, vid=0, audio=0, invalid=0;\n    int i;\n    int score=0;\n    for(i=0; i<p->buf_size; i++){\n        code = (code<<8) + p->buf[i];\n        if ((code & 0xffffff00) == 0x100) {\n            int pes= check_pes(p->buf+i, p->buf+p->buf_size);\n            if(code == SYSTEM_HEADER_START_CODE) sys++;\n            else if(code == PRIVATE_STREAM_1)    priv1++;\n            else if(code == PACK_START_CODE)     pspack++;\n            else if((code & 0xf0) == VIDEO_ID && pes) vid++;\n            else if((code & 0xe0) == AUDIO_ID && pes) audio++;\n            else if((code & 0xf0) == VIDEO_ID && !pes) invalid++;\n            else if((code & 0xe0) == AUDIO_ID && !pes) invalid++;\n        }\n    }\n    if(vid+audio > invalid)\n        score= AVPROBE_SCORE_MAX/4;\n    if(sys>invalid && sys*9 <= pspack*10)\n        return AVPROBE_SCORE_MAX/2+2;\n    if(priv1 + vid + audio > invalid && (priv1+vid+audio)*9 <= pspack*10)\n        return AVPROBE_SCORE_MAX/2+2;\n    if((!!vid ^ !!audio) && (audio+vid > 1) && !sys && !pspack && p->buf_size>2048)\n        return AVPROBE_SCORE_MAX/2+2;\n    return score;\n}']