On Fri, 14 Mar 2014 17:06:17 +0100
Luca Barbato <[email protected]> wrote:

> On 14/03/14 16:42, wm4 wrote:
> > On Thu, 13 Mar 2014 22:35:41 +0100
> > Luca Barbato <[email protected]> wrote:
> > 
> >> It should provide a quicker guess for elementary streams provided
> >> by http.
> > 
> > 
> >> @@ -212,6 +213,9 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, 
> >> int is_opened,
> >>              if (av_match_ext(lpd.filename, fmt1->extensions))
> >>                  score = AVPROBE_SCORE_EXTENSION;
> >>          }
> >> +        if (match_name(lpd.mime_type, fmt1->mime_type))
> >> +            score = FFMAX(score, AVPROBE_SCORE_EXTENSION);
> >> +
> >>          if (score > *score_max) {
> >>              *score_max = score;
> >>              fmt        = fmt1;
> > 
> > Can you explain how exactly the mime type is used in the probing
> > process? To me, it looks like it works equally to file extensions (and
> > the score is raised to AVPROBE_SCORE_EXTENSION), but on IRC you said
> > it's different.
> 
> The only part different is that match_ext works in a way slightly
> different from match_name and that I added a field in the probe so third
> parties (e.g. you if you decide to leverage curl for http in mpv) can
> enjoy it as well.
> 
> As I said on irc, for the scoring purpose it is pretty much the same.
> 
> > Personally, I'd probably trust mime types much more than file
> > extensions.
> 
> It is enough to trust it as a file extension, I could amend the patch to
> have a + 1 over the SCORE_EXTENSION.

That might work. For me as API user, it's more interesting to know
which format the mime type matches, though. Maybe add a separate public
function that searches for the format that matches a mime type, and use
that in the generic probe function?

What also might work: add an extra "confidence score" to the current
probe score if the mime type works. But I'm not too sure about this;
the way the scores are determined and used is already too complicated.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to