comparison utils.c @ 5941:bde9a4b67f86 libavformat

Reusing the probe buffer to rewind the ByteIOContext in ff_probe_input_buffer() instead of seeking back to the start of the file. Once exhausted, the size of the buffer is reduced.
author thardin
date Thu, 08 Apr 2010 09:02:27 +0000
parents d9f196991fe4
children 57789f5d12cf
comparison
equal deleted inserted replaced
5940:de489de0240a 5941:bde9a4b67f86
514 }else 514 }else
515 av_log(logctx, AV_LOG_DEBUG, "Probed with size=%d and score=%d\n", probe_size, score); 515 av_log(logctx, AV_LOG_DEBUG, "Probed with size=%d and score=%d\n", probe_size, score);
516 } 516 }
517 } 517 }
518 518
519 av_free(buf);
520
521 if (!*fmt) { 519 if (!*fmt) {
520 av_free(buf);
522 return AVERROR_INVALIDDATA; 521 return AVERROR_INVALIDDATA;
523 } 522 }
524 523
525 if (url_fseek(*pb, 0, SEEK_SET) < 0) { 524 /* rewind. reuse probe buffer to avoid seeking */
526 url_fclose(*pb); 525 if ((ret = ff_rewind_with_probe_data(*pb, buf, pd.buf_size)) < 0)
527 if (url_fopen(pb, filename, URL_RDONLY) < 0) 526 av_free(buf);
528 return AVERROR(EIO); 527
529 } 528 return ret;
530
531 return 0;
532 } 529 }
533 530
534 int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, 531 int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
535 AVInputFormat *fmt, 532 AVInputFormat *fmt,
536 int buf_size, 533 int buf_size,