[FFmpeg-devel] [PATCH] Make libavformat/avio.c:url_open complain when it reads bogus filename protocol prefix strings

Michael Niedermayer michaelni
Mon Oct 15 19:38:08 CEST 2007


On Mon, Oct 15, 2007 at 02:20:26PM +0200, Stefano Sabatini wrote:
> On date Sunday 2007-09-30 17:36:01 +0200, Stefano Sabatini encoded:
> > On date Saturday 2007-09-29 18:33:13 +0200, Michael Niedermayer encoded:
> > [...]
> > > if you think theres a bug FIRST explain VERY precissely what you think
> > > is buggy dont just randomly complicate the code and break existing
> > > syntax!
> > 
> > sds at santefisi ~/s/m/samples> ls -l foo:movie.avi 
> > -rw-r--r-- 1 sds sds 121727330 2007-09-27 16:19 foo:movie.avi
> > sds at santefisi ~/s/m/samples> ffmpeg -i foo:movie.avi 
> > FFmpeg version SVN-r10629, Copyright (c) 2000-2007 Fabrice Bellard, et al.
> > [...]
> > foo:movie.avi: no such file or directory
> > 
> > sds at santefisi ~/s/m/samples> ffmpeg -i file:foo:movie.avi 
> > FFmpeg version SVN-r10629, Copyright (c) 2000-2007 Fabrice Bellard, et al.
> > [...]
> > Input #0, avi, from 'file:foo:movie.avi':
> >   Duration: 00:00:53.4, start: 0.000000, bitrate: 18236 kb/s
> >   Stream #0.0: Video: ffv1, yuv420p, 720x576, 25.00 fps(r)
> >   Stream #0.1: Audio: mp2, 48000 Hz, stereo, 64 kb/s
> > Must supply at least one output file
> > 
> > sds at santefisi ~/s/m/samples> ffmpeg -i file://foo:movie.avi 
> > FFmpeg version SVN-r10629, Copyright (c) 2000-2007 Fabrice Bellard, et al.
> > [...]
> > file://foo:movie.avi: no such file or directory
> > 
> > Problem: when libavformat/avio.c:url_open reads a filename of the form:
> > something:rest-of-filename
> > 
> > when the string up to the ":" doesn't correspond to a recognized
> > protocol it fails telling that the file doesn't exist (not a very
> > helpful error message).
> > 
> > This problem is also reported in issue number 181.
> > 
> > Proposed solution:
> > 
> > to make url_open complain when it reads an unrecognized filename
> > protocol prefix like in the filename "foo:movie.avi", telling
> > explicitely something like:
> > "Unrecognized protocol: foo"
> > 
> > In this way the user has a chance to understand which is the problem,
> > and use instead the notation "file:foo:movie.avi" or change the
> > filename.
> > 
> > Luca (Barbato) and Rich also suggested to change the current syntax
> > file:rest-of-filename to file://rest-of-filename which seems to be
> > more "standard" and has less chance to conflict with usual
> > filenames. But I recognize this is another issue.
> > 
> > Attached patch corresponding to the proposed solution (note that I'm
> > also changing the name of the patch/thread to make it more adequate to
> > the purpose of the patch).
> 
> Ping (sorry for insisting).
> 
> Regards.
> -- 
> Stefano Sabatini
> Linux user number 337176 (see http://counter.li.org)

> Index: libavformat/avio.c
> ===================================================================
> --- libavformat/avio.c	(revision 10629)
> +++ libavformat/avio.c	(working copy)
> @@ -68,7 +68,8 @@
>              goto found;
>          up = up->next;
>      }
> -    err = AVERROR(ENOENT);
> +    av_log(NULL, AV_LOG_ERROR, "Unrecognized protocol: %s\n", proto_str);
> +    err = AVERROR(EILSEQ);

theres no relation between the addition of the error message and the change
of the return, these should be in seperate patches
also NULL is not a good choice

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071015/3cf813a3/attachment.pgp>



More information about the ffmpeg-devel mailing list