[FFmpeg-devel] [PATCH 2/2] img2dec: Add mime_type to image formats

Derek Buitenhuis derek.buitenhuis at gmail.com
Thu Feb 25 16:58:02 CET 2016


On 2/24/2016 3:19 PM, Carl Eugen Hoyos wrote:
> (Do you have an example where the probing fails?)
> 
> The idea of these additional demuxers is that they probe 
> the content instead of relying on the file suffix. 
> File suffix provides a score of _EXTENSION (50), so if probing 
> is possible and uses more than 16 bit, _EXTENSION + 1 is 
> returned to allow a better detection.
> AV_SCORE_MIME is 75, so iiuc this patch would just disable 
> autodetection (except for png, dds and webp which compare 
> 64 bit and return _MAX) in favour of the mimetype.
> Or am I reading the code incorrectly and mimetype doesn't 
> lead to a score of 75?
> 
> Why aren't the mimetypes added to the (original) image2 
> demuxer if they are really needed?

>From the author:

  First I'll address the image2 suggestion. It certainly is possible to put a large
  list of image MIME types in the image2 demuxer, however, a MIME type is associated
  with a specific image format, so it is a waste of information not to use it to
  detect the specific format when appropriate. The primary purpose of image2 is
  for image sequences, so using MIME types for that is not applicable at all.
  Just because image2 calls the other probe functions internally to select the
  codec doesn't mean that the other image formats shouldn't be first-class
  citizens in terms of detection.

  In terms of how the score for a MIME type match compares with those of the
  individual content matching probe functions, I'd say it makes sense. The
  stronger probing functions have a score which reflects their reliability. If
  a MIME type is specified, that does have significant weight in terms of
  probability, given that it was set somewhere either by a client or server
  program doing a content check or explicitly by some user. So maybe it should
  override the weaker content checks. It is similar to extension, but it is less
  likely to be arbitrary if present and matching a specific media format.

- Derek


More information about the ffmpeg-devel mailing list