[FFmpeg-devel] [PATCH] Use file protocol to deal with bogus protocol strings
Aurelien Jacobs
aurel
Fri Sep 28 00:06:01 CEST 2007
Rich Felker wrote:
> On Thu, Sep 27, 2007 at 11:13:32PM +0200, Luca Barbato wrote:
> > Stefano Sabatini wrote:
> > > Another (maybe cleaner) solution would be to request the user to
> > > specify the protocol string for ambiguos files such as foo:movie.mpeg,
> > > which should then be specified as file:foo:movie.mpeg. Anyway in this
> > > case ffmpeg should say something if it can't recognize the protocol
> > > (for example: unrecognized protocol: foo), rather than simply negate
> > > the existence of the file.
> >
> > what about enforcing the "://" separator?
>
> I agree, this is the correct solution since it avoids using any
> heuristics and cannot clash with valid filenames.
I'm not sure what you call a valid filename but I think that can
still clash:
$ mkdir -p http://samples.mplayerhq.hu/V-codecs/IV50
$ cp foo.avi http://samples.mplayerhq.hu/V-codecs/IV50/girl_01.avi
$ file http://samples.mplayerhq.hu/V-codecs/IV50/girl_01.avi
http://samples.mplayerhq.hu/V-codecs/IV50/girl_01.avi: RIFF (little-endian)
data, AVI, 320 x 240, 25.00 fps, video: DivX 5, audio: MPEG-1 Layer 3
(stereo, 48000 Hz)
$ ffmpeg -i http://samples.mplayerhq.hu/V-codecs/IV50/girl_01.avi
FFmpeg version SVN-r10579, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration:
libavutil version: 49.5.0
libavcodec version: 51.44.0
libavformat version: 51.14.0
built on Sep 25 2007 22:51:10, gcc: 4.2.1 (Debian 4.2.1-5)
Input #0, avi, from 'http://samples.mplayerhq.hu/V-codecs/IV50/girl_01.avi':
Duration: 00:00:26.0, start: 0.000000, bitrate: 418 kb/s
Stream #0.0: Video: IV50 / 0x30355649, 256x256, 30.00 fps(r)
So you can definitely make it clash if you try to...
But admittedly, it's easy for the user to avoid using 2 consecutive '/'
when specifying a file path, and thus avoiding clash. And it's much less
likely to clash anyway.
So using the "://" separator seems to be a very good solution (even if
it's not perfect).
Aurel
More information about the ffmpeg-devel
mailing list