[FFmpeg-devel] [PATCH] Make libavformat/avio.c:url_open return EILSEQ error code in case of unrecognized protocol prefix

Måns Rullgård mans
Wed Oct 17 11:09:16 CEST 2007


Stefano Sabatini wrote:
> On date Tuesday 2007-10-16 22:07:23 +0200, Michael Niedermayer encoded:
> [...]
>> > Suggested log: $subject
>> >
>> > Rationale: in avcodec.h are defined the various error codes.
>> >
>> > ENOENT corresponds to the error:
>> > "No such file or directory."
>> >
>> > which doesn't seem really descriptive about the error encountered in
>> > this case (unrecognized protocol).
>> >
>> > EILSEQ corresponds to the error
>> > "unknown format."
>> >
>> > and seems more adequate in this case.
>> >
>> > This patch also indirectly changes the error message issued, so we'll
>> > have now:
>> >
>> > stefano at geppetto ~/s/m/samples> ffmpeg -i foo:movie.avi
>> > [...]
>> > foo:movie.avi: Unknown format
>> >
>> > rather than:
>> > stefano at geppetto ~/s/m/samples> ffmpeg -i foo:movie.avi
>> > FFmpeg version SVN-r10755, Copyright (c) 2000-2007 Fabrice Bellard, et al.
>> > [...]
>> > foo:movie.avi: No such file or directory
>>
>> besides the question about appropriateness of EILSEQ
>> (Invalid or incomplete multibyte or wide character)
>> "Unknown format" is hardly better than "No such file or directory"
>
> Could you suggest a better error code to use, or should we define a
> new one?

ENOENT seems perfectly reasonable to me.  There is after all no such
file, or there would be no error.  EINVAL could perhaps also be
considered correct in this case.  EILSEQ is certainly wrong.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list