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

Benoit Fouet benoit.fouet at free.fr
Fri Sep 12 10:19:53 CEST 2014


Hi,

----- Mail original -----
> 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
> 

True, though this was the simplest solution I could propose.

> 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
> 

If we choose this patch, I'll look into this.

[...]

> 
> 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
> 

-- 
Ben


More information about the ffmpeg-devel mailing list