Revision 79750486

View differences:

libavformat/utils.c
237 237
    return filename && (av_get_frame_filename(buf, sizeof(buf), filename, 1)>=0);
238 238
}
239 239

  
240
AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened)
240
static AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
241 241
{
242 242
    AVInputFormat *fmt1, *fmt;
243
    int score, score_max;
243
    int score;
244 244

  
245 245
    fmt = NULL;
246
    score_max = 0;
247 246
    for(fmt1 = first_iformat; fmt1 != NULL; fmt1 = fmt1->next) {
248 247
        if (!is_opened == !(fmt1->flags & AVFMT_NOFILE))
249 248
            continue;
......
255 254
                score = 50;
256 255
            }
257 256
        }
258
        if (score > score_max) {
259
            score_max = score;
257
        if (score > *score_max) {
258
            *score_max = score;
260 259
            fmt = fmt1;
261 260
        }
262 261
    }
263 262
    return fmt;
264 263
}
265 264

  
265
AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened){
266
    int score=0;
267
    return av_probe_input_format2(pd, is_opened, &score);
268
}
269

  
266 270
/************************************************************/
267 271
/* input media file */
268 272

  
......
423 427
        }
424 428

  
425 429
        for(probe_size= PROBE_BUF_MIN; probe_size<=PROBE_BUF_MAX && !fmt; probe_size<<=1){
430
            int score= probe_size < PROBE_BUF_MAX ? AVPROBE_SCORE_MAX/4 : 0;
426 431
            /* read probe data */
427 432
            pd->buf= av_realloc(pd->buf, probe_size);
428 433
            pd->buf_size = get_buffer(pb, pd->buf, probe_size);
......
435 440
                }
436 441
            }
437 442
            /* guess file format */
438
            fmt = av_probe_input_format(pd, 1);
443
            fmt = av_probe_input_format2(pd, 1, &score);
439 444
        }
440 445
        av_freep(&pd->buf);
441 446
    }

Also available in: Unified diff