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

Stefano Sabatini stefano.sabatini-lala
Sun Sep 30 17:36:01 CEST 2007


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).

Regards.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make-url-open-complain-with-unrecognized-protocols-00.patch
Type: text/x-diff
Size: 466 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070930/67eceba5/attachment.patch>



More information about the ffmpeg-devel mailing list