avformat/img2dec: Fail probing when no data is yet available and the filename contains no number/glob patterns either.

Fixes Ticket3901

the seek test error codes change due to a change in the failure path,
this could be avoided by changing the respective error codes to EINVAL

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-09-11 16:48:03 +02:00
parent 917d14e6a2
commit b3fd2b175c
4 changed files with 80 additions and 78 deletions

View File

@ -162,6 +162,8 @@ static int img_read_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_MAX;
else if (is_glob(p->filename)) else if (is_glob(p->filename))
return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_MAX;
else if (p->buf_size == 0)
return 0;
else if (av_match_ext(p->filename, "raw") || av_match_ext(p->filename, "gif")) else if (av_match_ext(p->filename, "raw") || av_match_ext(p->filename, "gif"))
return 5; return 5;
else else

View File

@ -1,27 +1,27 @@
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size:317075 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size:317075
ret:-EINVAL st:-1 flags:0 ts:-1.000000 ret:-1 st:-1 flags:0 ts:-1.000000
ret:-EINVAL st:-1 flags:1 ts: 1.894167 ret:-1 st:-1 flags:1 ts: 1.894167
ret:-EINVAL st: 0 flags:0 ts: 0.800000 ret:-1 st: 0 flags:0 ts: 0.800000
ret:-EINVAL st: 0 flags:1 ts:-0.320000 ret:-1 st: 0 flags:1 ts:-0.320000
ret:-EINVAL st:-1 flags:0 ts: 2.576668 ret:-1 st:-1 flags:0 ts: 2.576668
ret:-EINVAL st:-1 flags:1 ts: 1.470835 ret:-1 st:-1 flags:1 ts: 1.470835
ret:-EINVAL st: 0 flags:0 ts: 0.360000 ret:-1 st: 0 flags:0 ts: 0.360000
ret:-EINVAL st: 0 flags:1 ts:-0.760000 ret:-1 st: 0 flags:1 ts:-0.760000
ret:-EINVAL st:-1 flags:0 ts: 2.153336 ret:-1 st:-1 flags:0 ts: 2.153336
ret:-EINVAL st:-1 flags:1 ts: 1.047503 ret:-1 st:-1 flags:1 ts: 1.047503
ret:-EINVAL st: 0 flags:0 ts:-0.040000 ret:-1 st: 0 flags:0 ts:-0.040000
ret:-EINVAL st: 0 flags:1 ts: 2.840000 ret:-1 st: 0 flags:1 ts: 2.840000
ret:-EINVAL st:-1 flags:0 ts: 1.730004 ret:-1 st:-1 flags:0 ts: 1.730004
ret:-EINVAL st:-1 flags:1 ts: 0.624171 ret:-1 st:-1 flags:1 ts: 0.624171
ret:-EINVAL st: 0 flags:0 ts:-0.480000 ret:-1 st: 0 flags:0 ts:-0.480000
ret:-EINVAL st: 0 flags:1 ts: 2.400000 ret:-1 st: 0 flags:1 ts: 2.400000
ret:-EINVAL st:-1 flags:0 ts: 1.306672 ret:-1 st:-1 flags:0 ts: 1.306672
ret:-EINVAL st:-1 flags:1 ts: 0.200839 ret:-1 st:-1 flags:1 ts: 0.200839
ret:-EINVAL st: 0 flags:0 ts:-0.920000 ret:-1 st: 0 flags:0 ts:-0.920000
ret:-EINVAL st: 0 flags:1 ts: 2.000000 ret:-1 st: 0 flags:1 ts: 2.000000
ret:-EINVAL st:-1 flags:0 ts: 0.883340 ret:-1 st:-1 flags:0 ts: 0.883340
ret:-EINVAL st:-1 flags:1 ts:-0.222493 ret:-1 st:-1 flags:1 ts:-0.222493
ret:-EINVAL st: 0 flags:0 ts: 2.680000 ret:-1 st: 0 flags:0 ts: 2.680000
ret:-EINVAL st: 0 flags:1 ts: 1.560000 ret:-1 st: 0 flags:1 ts: 1.560000
ret:-EINVAL st:-1 flags:0 ts: 0.460008 ret:-1 st:-1 flags:0 ts: 0.460008
ret:-EINVAL st:-1 flags:1 ts:-0.645825 ret:-1 st:-1 flags:1 ts:-0.645825

View File

@ -1,27 +1,27 @@
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size:2534775 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size:2534775
ret:-EINVAL st:-1 flags:0 ts:-1.000000 ret:-1 st:-1 flags:0 ts:-1.000000
ret:-EINVAL st:-1 flags:1 ts: 1.894167 ret:-1 st:-1 flags:1 ts: 1.894167
ret:-EINVAL st: 0 flags:0 ts: 0.800000 ret:-1 st: 0 flags:0 ts: 0.800000
ret:-EINVAL st: 0 flags:1 ts:-0.320000 ret:-1 st: 0 flags:1 ts:-0.320000
ret:-EINVAL st:-1 flags:0 ts: 2.576668 ret:-1 st:-1 flags:0 ts: 2.576668
ret:-EINVAL st:-1 flags:1 ts: 1.470835 ret:-1 st:-1 flags:1 ts: 1.470835
ret:-EINVAL st: 0 flags:0 ts: 0.360000 ret:-1 st: 0 flags:0 ts: 0.360000
ret:-EINVAL st: 0 flags:1 ts:-0.760000 ret:-1 st: 0 flags:1 ts:-0.760000
ret:-EINVAL st:-1 flags:0 ts: 2.153336 ret:-1 st:-1 flags:0 ts: 2.153336
ret:-EINVAL st:-1 flags:1 ts: 1.047503 ret:-1 st:-1 flags:1 ts: 1.047503
ret:-EINVAL st: 0 flags:0 ts:-0.040000 ret:-1 st: 0 flags:0 ts:-0.040000
ret:-EINVAL st: 0 flags:1 ts: 2.840000 ret:-1 st: 0 flags:1 ts: 2.840000
ret:-EINVAL st:-1 flags:0 ts: 1.730004 ret:-1 st:-1 flags:0 ts: 1.730004
ret:-EINVAL st:-1 flags:1 ts: 0.624171 ret:-1 st:-1 flags:1 ts: 0.624171
ret:-EINVAL st: 0 flags:0 ts:-0.480000 ret:-1 st: 0 flags:0 ts:-0.480000
ret:-EINVAL st: 0 flags:1 ts: 2.400000 ret:-1 st: 0 flags:1 ts: 2.400000
ret:-EINVAL st:-1 flags:0 ts: 1.306672 ret:-1 st:-1 flags:0 ts: 1.306672
ret:-EINVAL st:-1 flags:1 ts: 0.200839 ret:-1 st:-1 flags:1 ts: 0.200839
ret:-EINVAL st: 0 flags:0 ts:-0.920000 ret:-1 st: 0 flags:0 ts:-0.920000
ret:-EINVAL st: 0 flags:1 ts: 2.000000 ret:-1 st: 0 flags:1 ts: 2.000000
ret:-EINVAL st:-1 flags:0 ts: 0.883340 ret:-1 st:-1 flags:0 ts: 0.883340
ret:-EINVAL st:-1 flags:1 ts:-0.222493 ret:-1 st:-1 flags:1 ts:-0.222493
ret:-EINVAL st: 0 flags:0 ts: 2.680000 ret:-1 st: 0 flags:0 ts: 2.680000
ret:-EINVAL st: 0 flags:1 ts: 1.560000 ret:-1 st: 0 flags:1 ts: 1.560000
ret:-EINVAL st:-1 flags:0 ts: 0.460008 ret:-1 st:-1 flags:0 ts: 0.460008
ret:-EINVAL st:-1 flags:1 ts:-0.645825 ret:-1 st:-1 flags:1 ts:-0.645825

View File

@ -1,27 +1,27 @@
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size:7603575 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size:7603575
ret:-EINVAL st:-1 flags:0 ts:-1.000000 ret:-1 st:-1 flags:0 ts:-1.000000
ret:-EINVAL st:-1 flags:1 ts: 1.894167 ret:-1 st:-1 flags:1 ts: 1.894167
ret:-EINVAL st: 0 flags:0 ts: 0.800000 ret:-1 st: 0 flags:0 ts: 0.800000
ret:-EINVAL st: 0 flags:1 ts:-0.320000 ret:-1 st: 0 flags:1 ts:-0.320000
ret:-EINVAL st:-1 flags:0 ts: 2.576668 ret:-1 st:-1 flags:0 ts: 2.576668
ret:-EINVAL st:-1 flags:1 ts: 1.470835 ret:-1 st:-1 flags:1 ts: 1.470835
ret:-EINVAL st: 0 flags:0 ts: 0.360000 ret:-1 st: 0 flags:0 ts: 0.360000
ret:-EINVAL st: 0 flags:1 ts:-0.760000 ret:-1 st: 0 flags:1 ts:-0.760000
ret:-EINVAL st:-1 flags:0 ts: 2.153336 ret:-1 st:-1 flags:0 ts: 2.153336
ret:-EINVAL st:-1 flags:1 ts: 1.047503 ret:-1 st:-1 flags:1 ts: 1.047503
ret:-EINVAL st: 0 flags:0 ts:-0.040000 ret:-1 st: 0 flags:0 ts:-0.040000
ret:-EINVAL st: 0 flags:1 ts: 2.840000 ret:-1 st: 0 flags:1 ts: 2.840000
ret:-EINVAL st:-1 flags:0 ts: 1.730004 ret:-1 st:-1 flags:0 ts: 1.730004
ret:-EINVAL st:-1 flags:1 ts: 0.624171 ret:-1 st:-1 flags:1 ts: 0.624171
ret:-EINVAL st: 0 flags:0 ts:-0.480000 ret:-1 st: 0 flags:0 ts:-0.480000
ret:-EINVAL st: 0 flags:1 ts: 2.400000 ret:-1 st: 0 flags:1 ts: 2.400000
ret:-EINVAL st:-1 flags:0 ts: 1.306672 ret:-1 st:-1 flags:0 ts: 1.306672
ret:-EINVAL st:-1 flags:1 ts: 0.200839 ret:-1 st:-1 flags:1 ts: 0.200839
ret:-EINVAL st: 0 flags:0 ts:-0.920000 ret:-1 st: 0 flags:0 ts:-0.920000
ret:-EINVAL st: 0 flags:1 ts: 2.000000 ret:-1 st: 0 flags:1 ts: 2.000000
ret:-EINVAL st:-1 flags:0 ts: 0.883340 ret:-1 st:-1 flags:0 ts: 0.883340
ret:-EINVAL st:-1 flags:1 ts:-0.222493 ret:-1 st:-1 flags:1 ts:-0.222493
ret:-EINVAL st: 0 flags:0 ts: 2.680000 ret:-1 st: 0 flags:0 ts: 2.680000
ret:-EINVAL st: 0 flags:1 ts: 1.560000 ret:-1 st: 0 flags:1 ts: 1.560000
ret:-EINVAL st:-1 flags:0 ts: 0.460008 ret:-1 st:-1 flags:0 ts: 0.460008
ret:-EINVAL st:-1 flags:1 ts:-0.645825 ret:-1 st:-1 flags:1 ts:-0.645825