Revision 9870a7bd

View differences:

libavformat/mpeg.c
1262 1262

  
1263 1263
static int mpegps_probe(AVProbeData *p)
1264 1264
{
1265
    uint32_t code= -1;
1266
    int sys=0, pspack=0;
1265 1267
    int i;
1266
    int size= FFMIN(20, p->buf_size);
1267
    uint32_t code=0xFF;
1268 1268

  
1269
    /* we search the first start code. If it is a packet start code,
1270
       then we decide it is mpeg ps. We do not send highest value to
1271
       give a chance to mpegts */
1272
    /* NOTE: the search range was restricted to avoid too many false
1273
       detections */
1274

  
1275
    for (i = 0; i < size; i++) {
1276
        code = (code << 8) | p->buf[i];
1269
    for(i=0; i<p->buf_size; i++){
1270
        code = (code<<8) + p->buf[i];
1277 1271
        if ((code & 0xffffff00) == 0x100) {
1278
            if (code == PACK_START_CODE ||
1279
                code == SYSTEM_HEADER_START_CODE ||
1280
                (code >= 0x1e0 && code <= 0x1ef) ||
1281
                (code >= 0x1c0 && code <= 0x1df) ||
1282
                code == PRIVATE_STREAM_2 ||
1283
                code == PROGRAM_STREAM_MAP ||
1284
                code == PRIVATE_STREAM_1 ||
1285
                code == PADDING_STREAM)
1286
                return AVPROBE_SCORE_MAX - 2;
1287
            else
1288
                return 0;
1272
            switch(code){
1273
            case SYSTEM_HEADER_START_CODE:    sys++; break;
1274
            case          PACK_START_CODE: pspack++; break;
1275
            }
1289 1276
        }
1290 1277
    }
1278
    if(sys && sys*9 <= pspack*10)
1279
        return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg
1291 1280
    return 0;
1292 1281
}
1293 1282

  

Also available in: Unified diff