[Ffmpeg-devel] [PATCH] do not probe AVFMT_NOFILE formats if file is already opened

Reimar Döffinger Reimar.Doeffinger
Thu Jan 18 12:39:06 CET 2007

I am not sure about the supposed behaviour, but currently when calling
av_probe_input_format with is_opened == 1 the img2 demuxer will try to
substitute %d and open the resulting file names.
IMO it would be more desirable (and fixes a crash with mplayer) not to
try any demuxers that will open a file when is_opened == 1, as attached
patch does.
Also, after deciding about the supposed semantics, I would propose renaming
AVFMT_NOFILE to something that gives at least some hint about what it is
supposed to mean, the comment for it is just as stupid: "/* no file
should be opened */" well, obviously somewhen a "file" must be opened, so
is the comment supposed to mean no file should be opened by the caller,
or by the demuxer or...

Reimar D?ffinger
-------------- next part --------------
Index: libavformat/utils.c
--- libavformat/utils.c	(revision 7578)
+++ libavformat/utils.c	(working copy)
@@ -279,7 +276,7 @@
     fmt = NULL;
     score_max = 0;
     for(fmt1 = first_iformat; fmt1 != NULL; fmt1 = fmt1->next) {
-        if (!is_opened && !(fmt1->flags & AVFMT_NOFILE))
+        if (!is_opened == !(fmt1->flags & AVFMT_NOFILE))
         score = 0;
         if (fmt1->read_probe) {

More information about the ffmpeg-devel mailing list