[FFmpeg-devel] [PATCH] img2dec: make probing score zero for known file extensions.

Michael Niedermayer michaelni at gmx.at
Thu Sep 11 17:04:38 CEST 2014


On Thu, Sep 11, 2014 at 03:48:21PM +0200, Benoit Fouet wrote:
> When a known extension has its own probing function, make img_read_probe
> return 0, so that the probing functions are actually called instead of
> relying only on the file extensions.
> 
> Fixes issue #3901
> ---
>  libavformat/img2dec.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> index 8bbcddc..0be31c8 100644
> --- a/libavformat/img2dec.c
> +++ b/libavformat/img2dec.c
> @@ -155,6 +155,26 @@ fail:
>      return -1;
>  }
>  
> +/* Add entry here when/if a known extension has its own probing function */
> +static int ext_has_probe(const char *filename)
> +{
> +    const char extensions[] = "jpg,jpeg,jps,mpo"                     /* AV_CODEC_ID_MJPEG */
> +                              ",jls"                                 /* AV_CODEC_ID_MJPEG */
> +                              ",png,pns,mng"                         /* AV_CODEC_ID_PNG */
> +                              ",bmp"                                 /* AV_CODEC_ID_BMP */
> +                              ",tiff,tif"                            /* AV_CODEC_ID_TIFF */
> +                              ",sgi"                                 /* AV_CODEC_ID_SGI */
> +                              ",sun,ras,rs,im1,im8,im24,im32,sunras" /* AV_CODEC_ID_SUNRAST */
> +                              ",j2c,jp2,jpc,j2k"                     /* AV_CODEC_ID_JPEG2000 */
> +                              ",dpx"                                 /* AV_CODEC_ID_DPX */
> +                              ",exr"                                 /* AV_CODEC_ID_EXR */
> +                              ",pic"                                 /* AV_CODEC_ID_PICTOR */
> +                              ",webp"                                /* AV_CODEC_ID_WEBP */
> +                              ",gif"                                 /* AV_CODEC_ID_GIF */
> +                              ;
> +    return av_match_ext(filename, extensions);
> +}

keeping this in sync with the probe functions could be unreliable

also this fails 2 fate tests.
one might be fixed by using
"avformat/img2dec: reduce bmppipe probe score", which ive just posted
dunno why the 2nd fails

--- ./tests/ref/fate/bmp-4bit-os2       2014-09-11 04:41:39.223047181 +0200
+++ tests/data/fate/bmp-4bit-os2        2014-09-11 16:57:45.127977636 +0200
@@ -1,2 +0,0 @@
-#tb 0: 1/25
-0,          0,          0,        1,    19800, 0x563b599a
Test bmp-4bit-os2 failed. Look at tests/data/fate/bmp-4bit-os2.err for details.
make: *** [fate-bmp-4bit-os2] Error 1
...
-TAG:FileSource=  3
-TAG:CustomRendered=    0
-TAG:ExposureMode=    0
-TAG:WhiteBalance=    0
-TAG:DigitalZoomRatio=   4000:4000
-TAG:SceneCaptureType=    0
-[/FRAME]
TEST    filter-metadata-ebur128
Test exif-image-jpg failed. Look at tests/data/fate/exif-image-jpg.err for details.
make: *** [fate-exif-image-jpg] Error 1

also see the patchset ive just posted, but iam not totally happy with
mine either, espeially the special case for image2 kind of looks ugly

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140911/88d018c6/attachment.asc>


More information about the ffmpeg-devel mailing list