[FFmpeg-devel] [PATCH] print message if probe failed due to probe conflict

Reimar Döffinger Reimar.Doeffinger
Fri Sep 25 14:41:40 CEST 2009


On Fri, Sep 25, 2009 at 02:33:29PM +0200, Michael Niedermayer wrote:
> On Fri, Sep 25, 2009 at 02:11:38PM +0200, Reimar D?ffinger wrote:
> > If two probe functions return the same value, it is a bit hard to find
> > out which ones were involved and broke things.
> > So I propose this:
> 
> does your code work?
> it looks to me like it would print a warning if 3 demuxers return
> 1
> 1
> 90
> but not if they return 
> 1
> 90
> 1
> 
> simply printing all scores and piping through sort -n seems more usefull
> to me in this case ...

It was not supposed to print anything in both cases, if forgot to check
for fmt == NULL. I don't mean it as a test tool for conflicting probe
values, but as an actually useful message for users, only for the case
where probing actually fails.
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c (revision 20013)
+++ libavformat/utils.c (working copy)
@@ -287,6 +287,8 @@
 static AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
 {
     AVInputFormat *fmt1, *fmt;
+    AVInputFormat *conflict_fmt1 = NULL, *conflict_fmt2 = NULL;
+    int conflict_score = -1;
     int score;
 
     fmt = NULL;
@@ -304,9 +306,18 @@
         if (score > *score_max) {
             *score_max = score;
             fmt = fmt1;
-        }else if (score == *score_max)
+        }else if (score == *score_max) {
+            if (fmt) {
+                conflict_fmt1 = fmt;
+                conflict_fmt2 = fmt1;
+                conflict_score = score;
+            }
             fmt = NULL;
+        }
     }
+    if (!fmt && conflict_score > 0)
+        av_log(NULL, AV_LOG_WARNING, "No format match due to probe conflict between %s and %s with score %i\n",
+               conflict_fmt1->name, conflict_fmt2->name, conflict_score);
     return fmt;
 }
 



More information about the ffmpeg-devel mailing list