Revision 95f97de1 libavformat/mpeg.c

View differences:

libavformat/mpeg.c
1026 1026

  
1027 1027
static int mpegps_probe(AVProbeData *p)
1028 1028
{
1029
    int code, c, i;
1029
    int i;
1030
    int size= FFMIN(20, p->buf_size);
1031
    uint32_t code=0xFF;
1030 1032

  
1031
    code = 0xff;
1032 1033
    /* we search the first start code. If it is a packet start code,
1033 1034
       then we decide it is mpeg ps. We do not send highest value to
1034 1035
       give a chance to mpegts */
1035 1036
    /* NOTE: the search range was restricted to avoid too many false
1036 1037
       detections */
1037 1038

  
1038
    if (p->buf_size < 6)
1039
        return 0;
1040

  
1041
    for (i = 0; i < 20; i++) {
1042
        c = p->buf[i];
1043
        code = (code << 8) | c;
1039
    for (i = 0; i < size; i++) {
1040
        code = (code << 8) | p->buf[i];
1044 1041
        if ((code & 0xffffff00) == 0x100) {
1045 1042
            if (code == PACK_START_CODE ||
1046 1043
                code == SYSTEM_HEADER_START_CODE ||

Also available in: Unified diff